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

category_orders does not raise an error with incorrect column name #161

@Rabeez

Description

@Rabeez

I ran into this quite accidentally and am not sure whether this behaviour is mentioned in the documentation or not.

This code produces the correct output as expected

px.histogram(data_frame=iris, x='sepalLength', facet_col='species',
             category_orders={'species': ['versicolor','virginica','setosa']})

newplot (2)

Whereas, using an incorrect column name as the key for category_orders creates a plot which is identical to the one created when no ordering is specified.

px.histogram(data_frame=iris, x='sepalLength', facet_col='species',
             category_orders={'foo': ['versicolor','virginica','setosa']})

newplot (1)

In my opinion this should raise a ValueError similar to when an incorrect column is specified for the usual arguments (x, y, color etc).

Plotly 4.2.1
Python 3.7.4

EDIT: I just checked this with color instead of facet_col and the same issue is present obviously.

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