Closed
Description
Hi all,
Been looking forward for this for a long time. New 5.20.0 version does not work for me:
import pandas as pd
import plotly.graph_objects as go
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
trace = go.Scatter(
x=x,
y=y,
mode='none',
# fillcolor="rgba(0, 255, 0, .5)",
fillgradient=dict(
colorscale=[
[0.0, "rgba(0, 0, 255, 1)"],
[0.5, "rgba(0, 255, 0, 0)"],
[1.0, "rgba(0, 255, 0, 1)"]
],
start=0,
stop=1,
type='horizontal',
),
fill='tonexty',
hoveron='fills',
)
layout = go.Layout(
plot_bgcolor='white',
paper_bgcolor='white',
)
fig = go.Figure(trace, layout)
fig
data = {
"data": [
{
"x": [1, 1, 2, 2],
"y": [1, 2, 2, 1],
"type": "scatter",
"mode": "none",
"fill": "tonext",
"hoveron": "points+fills",
"fillgradient": {
"type": "horizontal",
"colorscale": [
[0.0, "rgba(0, 255, 0, 1)"],
[0.5, "rgba(0, 255, 0, 0)"],
[1.0, "rgba(0, 255, 0, 1)"]
]
}
},
{
"x": [0, 0, 3, 3],
"y": [0, 4, 4, 1],
"type": "scatter",
"mode": "none",
"fill": "tonext",
"hoveron": "fills+points",
"fillgradient": {
"type": "radial",
"colorscale": [
[0.0, "rgba(255, 255, 0, 0.0)"],
[0.8, "rgba(255, 0, 0, 0.3)"],
[1.0, "rgba(255, 255, 0, 1.0)"]
]
}
}
],
"layout": {
"autosize": True,
"title": { "text": "Scatter traces with radial color gradient fills" },
"showlegend": True
}
}
fig = go.Figure(data=data["data"], layout=data["layout"])
Any help will be appreciated.
This is my second ´fig´, I already checked and I am using v5.20.0
Metadata
Metadata
Assignees
Labels
No labels