Skip to content

clarify error message when using unsupported marginal plot type #4654

Description

@wdecoster

Hi,

The error below had me stumped for quite a while:

importplotlyaspxpx.scatter(x=[1,2,3], y=[2,3,4], marginal_x="density")
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/wdecoster/miniconda3/envs/data_analysis/lib/python3.12/site-packages/_plotly_utils/importers.py", line39, in__getattr__raiseAttributeError(
AttributeError: module'plotly'hasnoattribute'scatter'>>>importplotly.expressaspx^[[Apx.scatter(x=[1,2,3], y=[2,3,4], marginal_x="density")
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/wdecoster/miniconda3/envs/data_analysis/lib/python3.12/site-packages/plotly/express/_chart_types.py", line66, inscatterreturnmake_figure(args=locals(), constructor=go.Scatter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/wdecoster/miniconda3/envs/data_analysis/lib/python3.12/site-packages/plotly/express/_core.py", line2152, inmake_figuretrace=trace_spec.constructor(name=trace_name)
^^^^^^^^^^^^^^^^^^^^^^AttributeError: 'NoneType'objecthasnoattribute'constructor'

It turns out that "density" is not a supported type for a marginal plot, and I should have used "violin" instead.
But could this error message perhaps be more explicit about what is going wrong?

Best,
Wouter

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions