Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain padding values cause plots to overtake all other subplots #4144

Open
stephenpardy opened this issue Apr 3, 2023 · 0 comments
Open
Labels
bug something broken P3 not needed for current cycle

Comments

@stephenpardy
Copy link
Contributor

stephenpardy commented Apr 3, 2023

Related to #4124 there is a set of padding values that will produce strange behavior such that a single subplot takes over all others.

Some setup:

import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
line_x = np.arange(10)
line_y = line_x**2

What works:

n_subplots = 6

full_fig = make_subplots(
    rows=n_subplots,
    cols=1,
)

for row_idx in range(1, n_subplots+1):
    full_fig.add_trace(go.Scatter(
            x=line_x,
            y=line_y,
            showlegend=False,
        ), row=row_idx, col=1)

This produces 6 different subplots of the same line.

What doesn't work:

line_x = np.arange(10)
line_y = line_x**2

n_subplots = 8
padding_size = 0.1

row_heights = [0.1]*n_subplots

specs = []
for _ in range(n_subplots):
    specs.append([{'b': padding_size/2., 't': padding_size/2.}])

full_fig = make_subplots(
    rows=n_subplots,
    cols=1,
    row_heights=row_heights,
    specs=specs,
)

for row_idx in range(1, n_subplots+1):
    full_fig.add_trace(go.Scatter(
            x=line_x,
            y=line_y,
            showlegend=False,
        ), row=row_idx, col=1)

Adding the padding and row heights now generates only a single plot.

@gvwilson gvwilson self-assigned this Jul 11, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 not needed for current cycle bug something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants