Skip to content

Handling of Polars decimals in scales #1033

@jnolis

Description

@jnolis

Hello!

As an R user more and more using Python I am a huge fan of this package!

I ran into a problem recently due to a Decimal column in a Polars DataFrame. It seems like in some contexts plotnine treats them as discrete and not continuous values. I have a work around of changing the columns to Floats, but ideally that wouldn't be necssary.

Thank you!

This is an example of something I would expect to work but does not:

df = pl.DataFrame({"x": ["a","b","c"], "y": [1,2,3]}, schema= {"x":pl.String(),"y": pl.Decimal()})
ggplot(df, aes(x = "x", y = "y")) + geom_col() + scale_y_continuous(limits = [0,5])

Returns TypeError: Discrete value supplied to continuous scale

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions