-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect fill in graph objects when connectgaps is set to false #5105
Comments
Thanks for the bug report @NoniosTheMad - can you please run |
Of course: Package Version asttokens 3.0.0 |
Hey, just a follow up, since I've noticed something else happening on the same conditions: import plotly.graph_objects as go
import math
fig = go.Figure()
def remove_from_list(lst, idx):
return lst[:idx] + [None] + lst[idx+1:]
x = [i for i in range(10)]
y = [math.sin(v / 2) for v in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 6),
connectgaps=False
))
y = [math.sin(v/4) + 4 for v in x]
fig.add_trace(go.Scatter(
x=x,
y=remove_from_list(y, 6),
fill='tonexty',
connectgaps=False
))
fig.show() It seems the lower graph is joined with itself. This makes me suspect that it is just choosing the wrong points to join: Regardless of the cause of the bug, I'd like to question whether this is the desired behavior. To me, it seems very unintuitive to choose connectgaps=False but see that the filled area is connecting them regardless. |
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: