Open
Description
Description
I am trying to use the fillgradient
in a scatter plot with plotly
.
I copied the documentation code for its use, but on code execution, the gradient does not appear.
Operating system & Environment
- OS: macOS Sonoma
14.5
- language: python
3.11.3
- relevant libraries (working on VSCode in a jupyter notebook)
- plotly
5.22.0
- jupyterlab
3.6.3
- ipywidgets
8.0.4
- notebook
6.5.4
- plotly
Code used
import plotly.graph_objects as go
fig = go.Figure(
[
go.Scatter(
x=[1, 2, 3, 4],
y=[3, 4, 8, 3],
fill=None,
mode="lines",
line_color="darkblue",
),
go.Scatter(
x=[1, 2, 3, 4],
y=[1, 6, 2, 6],
fill="tonexty",
mode="lines",
line_color="darkblue",
fillgradient=dict(
type="horizontal",
colorscale=[(0.0, "darkblue"), (0.5, "royalblue"), (1.0, "cyan")],
),
),
]
)
fig.show()