fig = go.Figure(layout_yaxis_range=[0,10])
fig.add_traces(go.Scatter(
x=df['date'],
y=df['25 Percentile'],
name = '25th Percentile',
mode='text',
line=dict(color='blue'),
fill='tonext',
fillcolor='grey',
connectgaps=False
))
fig.add_traces(go.Scatter(
x=df['date'],
y=df['Median'],
name = 'Median',
mode='lines',
line=dict(color='green'),
fill='tonexty',
fillcolor='#eaecee',
connectgaps=False
))
fig.add_traces(go.Scatter(
x=df['date'],
y=df['75 Percentile'],
name = '75th Percentile',
mode='text',
line=dict(color='blue'),
fill='tonexty',
fillcolor='#eaecee',
connectgaps=False
))
fig.update_layout(template='plotly_white')
fig.show()
I'm trying to fill area between three lines But can't get rid of this dark shadows. I have tried to make sure fill='' parameter is right by changing it to all available values but not sure which one will work.
How do i remove this dark shadows?
mode="text"
have changed to mode="lines"
fill="tonexty"
on percentile tracesimport plotly.graph_objects as go
import pandas as pd
import numpy as np
df = pd.DataFrame({"date": pd.date_range("30-mar-2022", "15-may-2022")}).assign(
val=lambda d: np.random.randint(1, 10, len(d))
)
df = df.join(
df["val"]
.rolling(5)
.agg(["median", lambda w: np.percentile(w, 25), lambda w: np.percentile(w, 75)])
).dropna()
df.columns = ["date", "val", "Median", "25 Percentile", "75 Percentile"]
fig = go.Figure(layout_yaxis_range=[0, 10])
fig.add_traces(
go.Scatter(
x=df["date"],
y=df["25 Percentile"],
name="25th Percentile",
mode="lines",
line=dict(color="blue"),
# fill='tonext',
# fillcolor='grey',
connectgaps=False,
)
)
fig.add_traces(
go.Scatter(
x=df["date"],
y=df["Median"],
name="Median",
mode="lines",
line=dict(color="green"),
fill="tonexty",
fillcolor="#eaecee",
connectgaps=False,
)
)
fig.add_traces(
go.Scatter(
x=df["date"],
y=df["75 Percentile"],
name="75th Percentile",
mode="lines",
line=dict(color="blue"),
fill="tonexty",
fillcolor="#eaecee",
connectgaps=False,
)
)
fig.update_layout(template="plotly_white")
fig.show()