Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Property zorder cannot be updated on Scattergl traces. #4746

Copy link
Copy link
Closed
@PhilippVerpoort

Description

@PhilippVerpoort
Issue body actions

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.

Metadata

Metadata

Assignees

Labels

P3backlogbacklogbugsomething brokensomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.