You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever a graph object has the following parameters:
First series -> fill='tonexty',
Second series -> connectgaps=False
The fill connects the first point of this series with the first point of the last segment after "gaps" from the second series, instead of its respective first value.
Here is a basic example
import plotly.graph_objects as go
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(5)]
y = [1 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 2),
connectgaps=False
))
y = [2 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=y,
fill='tonexty',
))
fig.show()
Here is another example with more than 1 gap in the data:
import plotly.graph_objects as go
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(8)]
y = [1 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(remove_from_list(y, 2), 5),
connectgaps=False
))
y = [2 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=y,
fill='tonexty',
))
fig.show()
I've also attached their respective figure outuputs.
Finally, I have an additional comment regarding how areas are filled.
The following shows another basic example with gaps in both series, and both with connectgaps=False.
import plotly.graph_objects as go
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(5)]
y = [1 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 2),
connectgaps=False
))
y = [2 for _ in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 2),
fill='tonexty',
connectgaps=False
))
fig.show()
The connected area spans even the places where the values are undefined (during a gap). My expectation would be the opposite:
The text was updated successfully, but these errors were encountered:
Thanks for the bug report @NoniosTheMad - can you please run pip list or the equivalent and give us the versions of Python and plotly.py you're using? thanks - @gvwilson
Whenever a graph object has the following parameters:
First series -> fill='tonexty',
Second series -> connectgaps=False
The fill connects the first point of this series with the first point of the last segment after "gaps" from the second series, instead of its respective first value.
Here is a basic example
Here is another example with more than 1 gap in the data:
I've also attached their respective figure outuputs.
Finally, I have an additional comment regarding how areas are filled.
The following shows another basic example with gaps in both series, and both with connectgaps=False.
The connected area spans even the places where the values are undefined (during a gap). My expectation would be the opposite:

The text was updated successfully, but these errors were encountered: