Plotly express facet plot with free axis range

Plotly express does not seem to have an argument to auto-scale each individual plot of a facet plot. Typically:
px.line(df, x='Time', y='value', color='case', facet_row='variable')
builds a facet plot where each subplot has the same x and y axis range.
What is the best way to override that behavior?

1 Like

This can be done with:

fig = px.line(df, x='Time', y='value', color='case', facet_row='variable')
for k in fig.layout:
    if re.search('yaxis[1-9]+', k):
        fig.layout[k].update(matches=None)
2 Likes

I find the various update_... functions to quite helpful and am still getting used to taking advantage of them.

Here I think a quicker solution would be …

fig = fig.update_yaxes(matches=None)

# or, too add tick labels to all the axes now ...
fig = fig.update_yaxes(matches=None, showticklabels=True)

THere’s no need to, unless I’m missing something, to filter out all of the additional y axes. Just setting them all to be independent is all that is needed and update_yaxes() does this nicely.