Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Using px.density_contour with both marginal_x and contours_coloring causes error #175

@adamerose

Description

@adamerose

I get the error below when trying to add marginal_x to the "continuously-colored and labeled" example on this page https://plotly.com/python/2d-histogram-contour/

import plotly.express as px

df = px.data.tips()

fig = px.density_contour(df, x="total_bill", y="tip", marginal_x='box')
fig.update_traces(contours_coloring="fill", contours_showlabels=True)
"C:\Program Files\Python38\python.exe" D:/_MyFiles/Programming/scratch/scratch.py
Traceback (most recent call last):
  File "D:/_MyFiles/Programming/scratch/scratch.py", line 6, in <module>
    fig.update_traces(contours_coloring="fill", contours_showlabels=True)
  File "C:\Program Files\Python38\lib\site-packages\plotly\basedatatypes.py", line 1376, in update_traces
    trace.update(patch, overwrite=overwrite, **kwargs)
  File "C:\Program Files\Python38\lib\site-packages\plotly\basedatatypes.py", line 5067, in update
    BaseFigure._perform_update(self, kwargs, overwrite=overwrite)
  File "C:\Program Files\Python38\lib\site-packages\plotly\basedatatypes.py", line 3862, in _perform_update
    raise err
ValueError: Invalid property specified for object of type plotly.graph_objs.Box: 'contours'

...

Bad property path:
contours_coloring
^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions