-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fig.add_line similar to add_(h|v)line #3370
Copy link
Copy link
Closed
Description
I often find myself needing a parity line (aka identity line, i.e. x = y) across the whole plot that cannot be zoomed/panned away similar to add_(h|v)line.
How about adding a new method fig.add_line() that takes an anchor point [x0, y0] = [0, 0] along with a slope = 1?
If the plot has equal x and y range, I currently use this as a workaround:
import plotly.graph_objects as go
fig = go.Figure()
line_dict = dict(
type="line", yref="paper", y0=0, y1=1, xref="paper", x0=0, x1=1, opacity=0.1
)
fig.update_layout(shapes=[line_dict])
fig.update_xaxes(range=[0, 100])
fig.update_yaxes(range=[0, 100])
fig.write_image("tmp.png")Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
