# Resizing is not working after setting height in Plotly.relayout

**URL:** <https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196>\
**Category:** plotly.js\
**Created:** [September 24, 2016, 7:26pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196 "2016-09-24T19:26:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![eagor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eagor/32/424_2.png) [@eagor](https://community.plotly.com/u/eagor)\
**Post date:** [September 24, 2016, 7:26pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/1 "2016-09-24T19:26:04Z")

</div>

Plotly.Plots.resize doesn’t seem to work after I set height useing Plotly.relayout method.  
Demo: [http://codepen.io/eagor/pen/EgWERX](http://codepen.io/eagor/pen/EgWERX)  
If you comment out line 13, resizing will work just fine, but all the plotting is crammed into the initial height.  
Not sure if it’s expected behaviour, but by setting only the height I would like the chart to respond to horizontal resizing. Is is possible to achive now?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [September 26, 2016, 1:19pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/2 "2016-09-26T13:19:12Z")

</div>

It is the expected behavior as that `relayout` calls makes the graph have a fixed width and fixed width graph can’t be modified under `Plotly.Plots.resize`.

> [@eagor](#):
>
> but by setting only the height I would like the chart to respond to horizontal resizing. Is is possible to achive now?

Here’s how: [http://codepen.io/etpinard/pen/yabajo](http://codepen.io/etpinard/pen/yabajo)

---

<div class="post-metadata">

**Author:** ![eagor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eagor/32/424_2.png) [@eagor](https://community.plotly.com/u/eagor)\
**Post date:** [September 29, 2016, 2:00pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/3 "2016-09-29T14:00:45Z")

</div>

Thank you.

But in your example I can’t find where I set the height (on line 15 doesn’t work).

I need to set height manually to fit horizontal bar chart with large number of bars within little widget, keeping bars maintain same height. Here’s exact reproduction of my use case: [http://codepen.io/eagor/pen/EgWERX](http://codepen.io/eagor/pen/EgWERX) (updated in question as well).  
Or, maybe, there’s better way to do this?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [September 29, 2016, 3:00pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/4 "2016-09-29T15:00:46Z")

</div>

Here’s a working example with a set height: [http://codepen.io/etpinard/pen/KgvavA](http://codepen.io/etpinard/pen/KgvavA)

---

<div class="post-metadata">

**Author:** ![eagor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eagor/32/424_2.png) [@eagor](https://community.plotly.com/u/eagor)\
**Post date:** [September 30, 2016, 9:17am UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/5 "2016-09-30T09:17:15Z")

</div>

Legend!! Thank you!.

Applied to my example, in case somebody would need it: [http://codepen.io/eagor/pen/xELaZY](http://codepen.io/eagor/pen/xELaZY)

---

<div class="post-metadata">

**Author:** ![eagor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eagor/32/424_2.png) [@eagor](https://community.plotly.com/u/eagor)\
**Post date:** [October 17, 2016, 9:17am UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/6 "2016-10-17T09:17:24Z")

</div>

Something happend to the relayout process.  
It’s not showing correctly on initial render (only after window resize) on latest version.  
Works well on 1.16.2 though (try to uncomment \<script 1.16.2\> tag.)  
Also, I have some other issues with my other plots after latest update. Not sure if this should be separate thread, but my old code is broken with 1.18.0.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [October 17, 2016, 2:17pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/7 "2016-10-17T14:17:42Z")

</div>

please submit a bug report to [https://github.com/plotly/plotly.js/issues/new](https://github.com/plotly/plotly.js/issues/new)

thanks.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [October 17, 2016, 8:44pm UTC](https://community.plotly.com/t/resizing-is-not-working-after-setting-height-in-plotly-relayout/2196/8 "2016-10-17T20:44:09Z")

</div>

I was able to reproduce the problem.

I made a fix for in [https://github.com/plotly/plotly.js/pull/1049](https://github.com/plotly/plotly.js/pull/1049)

The problem will be fixed in plotly.js `1.18.1` set to be released tomorrow morning UTC-4
