Shared_yaxes applied to all cells instead of being applied grid wise how to?


#1

Based on the example ‘Subplots with Shared Y-Axes’ (code below), how can sharedy_axis=True be applied to all cells at the same time instead of being applied grid wise? In the desired plot, both Y axis would approximately span a range of [0, 9000].

from plotly import tools
import plotly.plotly as py
import plotly.graph_objs as go

trace0 = go.Scatter(
x=[1, 2, 3],
y=[2, 3, 4]
)
trace1 = go.Scatter(
x=[20, 30, 40],
y=[5, 5, 5],
)
trace2 = go.Scatter(
x=[2, 3, 4],
y=[600, 700, 800],
)
trace3 = go.Scatter(
x=[4000, 5000, 6000],
y=[7000, 8000, 9000],
)

fig = tools.make_subplots(rows=2, cols=2, shared_yaxes=True)

fig.append_trace(trace0, 1, 1)
fig.append_trace(trace1, 1, 2)
fig.append_trace(trace2, 2, 1)
fig.append_trace(trace3, 2, 2)

fig[‘layout’].update(height=600, width=600,
title=‘Multiple Subplots with Shared Y-Axes’)
py.iplot(fig, filename=‘multiple-subplots-shared-yaxes’)


#2

Hi @alexpetit12,

Unfortunately it’s not (yet) possible to automatically link together axes that aren’t shared across a row/column. Here’s a Plotly.js issue on the matter https://github.com/plotly/plotly.js/issues/1549.

-Jon


#3

Hi Jon. Thanks for answering.