Skip to content

Bug: Cannot draw h/v line for the subplot with a 'paper' sticky mode. #3051

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

Closed
ievgennaida opened this issue Jan 28, 2021 · 1 comment
Closed

Comments

@ievgennaida
Copy link

plotly 4.14.3

I cannot make a h/v line 'sticky' relatively to the subplots.

'paper' property is respected only when the line is drawn for the whole plot but not for the individual subplots.

See those two lines:

fig.add_shape(line, row=1, col=2)
import plotly.graph_objects as go
import json
import plotly
from io import StringIO
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(
            cols=4,
            rows=2,
            # share only in rows:
            #shared_yaxes="rows",
            #subplot_titles=['first','', 'second', 'third'],
        )


a_line = dict(color='rgb(1, 4, 4)')
b_line = dict(color='rgb(44, 160, 101)')
c_line = dict(color='rgb(222, 160, 222)')

# facet 1
fig.add_trace(go.Scatter(y=[1, 1], x=[1,1], legendgroup="A 1", name="A",line=a_line, showlegend = False),1, 1)
fig.add_trace(go.Scatter(y=[1, 1], x=[1,1], legendgroup="A 1", name="A",line=a_line, showlegend = False),1, 2)
fig.add_trace(go.Scatter(y=[1, 1], x=[1,1], legendgroup="A 1", name="A",line=a_line, showlegend = False),1, 3)

# facet 1
fig.add_trace(go.Scatter(y=[2, 2], x=[2,2], legendgroup="B 1", name="B",line=b_line, showlegend = True),1, 2)
fig.add_trace(go.Scatter(y=[2, 2], x=[2,2], legendgroup="B 1", name="B",line=b_line, showlegend = False),1, 2)
fig.add_trace(go.Scatter(y=[2, 2], x=[2,2], legendgroup="B 1", name="B",line=b_line, showlegend = False),2, 2)

# facet 2
fig.add_trace(go.Scatter(y=[1, 1], x=[1,1], legendgroup="A 1", name="A 1",line=a_line, showlegend = False),2, 2)
fig.add_trace(go.Scatter(y=[2, 2], x=[2,2], legendgroup="B 1", name="B 1",line=b_line, showlegend = False),2, 2)

fig.add_trace(go.Scatter(y=[2, 2], x=[2,2], legendgroup="B 1", name="B",line=b_line, showlegend = False),2, 3)
fig.add_trace(go.Scatter(y=[2, 2], x=[2,2], legendgroup="B 1", name="B",line=b_line, showlegend = False),2, 3)
#fig.add_trace(go.Scatter(y=[3, 3], x=[3,3], legendgroup="C", name="C",line=c_line, showlegend = False),row=3, col=3)

line = dict(type="line", xref="x", x0=1.5,  x1=1.5, yref="paper", y0=0, y1=1)

# fig.add_shape(shape, row=1, col=2)

# globally it works:
fig.update_layout(shapes=[line])

# for a specific subplot 'paper' is ignored :
fig.add_shape(line, row=1, col=2)



fig.show()

image

image

Might be related issue:

#2980

@ievgennaida
Copy link
Author

Works ok when 'y domain' is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant