Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

2 y axis right overlay not working/formatting is off

Hi,
I’m trying to create a plot with 6 subplots, with the bottom 3 plots having 2 y axes on on overlay. I followed the example provided completely (https://plot.ly/~empet/14352/defining-subplots-with-two-y-axes-in-eac/) and I get an output, but for some reason the y axes aren’t aligned at all. I’ve tried setting custom ranges to 0, custom setting the domain, but I’m getting the same issue.

I have no idea what the problem is- is this just a bug with the system? Appreciate the help.

@ronenshohat Please post your code in order to be able to find out what’s going wrong.

here’s a quick example of my layout:

fig = tools.make_subplots(rows=2, cols=3, subplot_titles=('USA', 'CA',
                                                      'JP'))
fig.append_trace(trace10,1,1)
fig.append_trace(trace1,2,1)
fig.append_trace(trace2,2,1)
fig.append_trace(ctrace10,1,2)
fig.append_trace(ctrace1,2,2)
fig.append_trace(ctrace6,2,2)
fig.append_trace(ntrace10,1,3)
fig.append_trace(ntrace1,2,3)
fig.append_trace(ntrace6,2,3)

fig['layout']['yaxis40']=dict(
                          overlaying= 'y4', 
                          anchor= 'x4', 
                          side= 'right', 
                          showgrid= False, 
                         )
    fig['layout']['yaxis50']=dict( 
                              overlaying= 'y5', 
                              anchor= 'x5', 
                              side= 'right', 
                              showgrid= False, 
                             )
    fig['layout']['yaxis60']=dict( 
                              overlaying= 'y6', 
                              anchor= 'x6', 
                              side= 'right', 
                              showgrid= False, 
                             )
fig['data'][2].update(yaxis='y40')
fig['data'][5].update(yaxis='y50')
fig['data'][8].update(yaxis='y60')

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]  [ (1,3) x3,y3 ]
[ (2,1) x4,y4 ]  [ (2,2) x5,y5 ]  [ (2,3) x6,y6 ]

Another thing to note is that for some reason this only seems to happen with 3 columns. Overlaying with 2 columns gives no such issue. Maybe it’s an issue with margins?

@ronenshohat I experimented the subplots with 3 columns https://plot.ly/~empet/14694, and it works fine. I’m almost sure you have somewhere a wrong fig[ 'layout']['xaxis{}'.format(k)] or
fig[ 'layout']['yaxis{}'.format(k)] update (for some k).

That’s not true- I literally followed your documentation word for word and am getting the same thing. What format could possibly cause this? I’ve done this with and without ranges… Also just to clarify- this is done with 2 rows and 3 columns, not 1 row and 3 columns. When I do the exact same thing but with 2 rows and 2 columns with the exact same formatting, everything works fine.

So I think the issue is with autorange. For some reason if you leave it to autorange it gives you this messed up format, but if you manual range it then things get aligned. The issue is my report’s numbers will vary significantly over time- is there still no functionality to set a minimum range with no set maximum? I’ve seen forum posts regarding this from over a year ago

@ronenshohat As long as I don’t have the code to reproduce your issue, it’s difficult to deduce what’s going wrong.

It could be the horizontal spacing, vertical spacing, a value assigned to a key in layout update, and so on.