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

Property zorder cannot be updated on Scattergl traces. #4746

Closed
PhilippVerpoort opened this issue Aug 30, 2024 · 2 comments
Closed

Property zorder cannot be updated on Scattergl traces. #4746

PhilippVerpoort opened this issue Aug 30, 2024 · 2 comments
Assignees
Labels
bug something broken P3 backlog

Comments

@PhilippVerpoort
Copy link

PhilippVerpoort commented Aug 30, 2024

Updating the zorder property on existing traces only works for go.Scatter traces but not for go.Scattergl traces. The same command may therefore fail or succeed, simply depending on the number of traces.

This works as expected:

import plotly.express as px

df_small = pd.DataFrame(dict(x=range(5), y=range(5)))

px.line(df_small).update_traces(zorder=-1)

This returns error Bad property path: zorder:

import plotly.express as px
import pandas as pd

df_large = pd.concat([
    df_small.assign(y=lambda df: df['y'] + n/1000, n=n)
    for n in range(1000)
])

px.line(df_large, color='n').update_traces(zorder=-1)  # calling update_traces raises ValueError with message 'Bad property path: zorder'

The difference between the two is that the first creates simple go.Scatter traces, whereas the second dataframe is so large that plotly tries to use go.Scattergl traces. Those however do not accept the zorder property (see also the documentation of go.Scattergl).

If for some reason the zorder cannot be implemented on go.Scattergl graph objects, then plotly should just not provide it and instead warn the user. The same code resulting in behaviour depending on the size of the dataframe passed is really unexpected and can be tedious to debug.

This issue may also be linked to #1514.

@gvwilson gvwilson added bug something broken P3 backlog labels Sep 3, 2024
@gvwilson
Copy link
Contributor

gvwilson commented Sep 3, 2024

possibly related to plotly/plotly.js#7070 ? cc @archmoj

@archmoj
Copy link
Contributor

archmoj commented Oct 3, 2024

zorder option is only available for SVG traces. WebGL based traces e.g. scattergl do not have this option.
It may possible to consider adding it.
But that would be a feature request.

@archmoj archmoj closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

3 participants