Skip to content
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

Mix of Scatter and Scattergl - Scattergl is always on top #1514

Closed
wdobbels opened this issue Apr 11, 2019 · 2 comments
Closed

Mix of Scatter and Scattergl - Scattergl is always on top #1514

wdobbels opened this issue Apr 11, 2019 · 2 comments

Comments

@wdobbels
Copy link

A typical use case for me is to have a bunch of scatterpoints (need Scattergl), and then fit a line through them (ideally with normal Scatter). However, no matter the order of the traces, Scattergl always seems to end on top (and hence the line disappears below the scatter points). Ideally, the order of the traces should be retained (no matter if it's a Scatter or Scattergl). Even better would be a zorder parameter (as in matplotlib), where we don't need to worry about the order in which we add the traces to the data.

Here's some code to reproduce the bug:

import plotly.offline as py
import plotly.graph_objs as go

trace_scatter = go.Scattergl(x=[1, 2, 3, 4], y=[1, 2, 3, 4], mode='markers')
trace_line = go.Scatter(x=[1, 4], y=[1, 4], mode='lines')
# line trace is placed last, so should end up top - but it doesn't
data = [trace_scatter, trace_line]
py.iplot(data)

If Scattergl is replaced by Scatter, the line is correctly drawn up top. I tested this in offline mode but assume the same is true in online mode. I'm new to plotly so I don't know enough about its inner workings to do a pull request right now (if really needed, with some pointings in the right direction, I could take a look).

@jonmmease
Copy link
Contributor

Hi @wouterdobbels, thanks for the suggestion.

See plotly/plotly.js#3748 for a recent discussion of this in the plotly.js project. Feel free to chime in there if you have API suggestions.

@gvwilson
Copy link
Contributor

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants