I can find how to set the width/height of the figure by changing the ‘layout’ attribute. How can I set height/width of individual subplots? Is this functionality available?
For individual heights/widths of subplots, check out this tutorial: https://plot.ly/python/subplots/#custom-sized-subplot
You need to fiddle with the xaxis/yaxis domains to get a proportion that you want.
Hope this helps!
I am able to change the xaxis/yaxis domains as per the tutorial. But it appears to be a relative size (since it normalizes to 1). What I want to be able to do is to set a size in pixels for width and height for individual subplots. this way I can ensure, the plots don’t become tiny when I am plotting 10 rows x 10 cols. I am ok with scrolling the page in my browser to see the plots. Is there a way to do that?
@Adam, just checking back to see if you had any insights. If there is no way around it, it would be helpful to know
If you want to set width/height of subplots in pixels you first
layout.margin.right, in pixels.
Then the plotting rectangle has the width =layout.width - layout.margin.left - layout.margin.right
and the height= layout.height - layout.margin.top - layout.margin.bottom.
In such a rectangle you set the width and height of each subplot, in pixels.
Then you define a scaling map from the rectangle
[0, layout.width - layout.margin.left - layout.margin.right]x[0, layout.height - layout.margin.top - layout.margin.bottom] to the rectangle [0,1]x [0,1].
This mapping let you find out the domain for the xaxis, yaxis associated to your subplots.
Thanks @empet. This does the trick!
Would anyone mind posting some small code example of how to fix a constant height for each subplot? I’m basically aiming for something as @siddharthm in Setting height/width of subplot , trying to create new (sub-)plots in plot.ly Dash on button click. I’ve been experimenting with
layout = go.Layout(...,
figure['layout'][... but I cannot get it to work properly.
Any help would be much appreciated!
@ siddharthm can you post a snippet of your code?
got lost with all the params here and where to put them
I want exactly what you did - only 2 columns instead of three
could it be possible for you to share this portion of your code.
thank you very much in advance for your help