You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Florian R. Hölzlwimmer, Cristian Capdevila, Ben Schneider, Marco Edward Gorelli, Nick Youngblut, gab23r, Julien Cornebise, Jakub Cierocki, Akbar Fadiansyah, kdkavanagh and 6 more
I suppose the sensible way here would be to check if it has a 'to_pandas' (or even a to_frame()?) method,
and then convert it - I don't think plotnine should require polars support just to check for it's classes.
polars is the future but there are still some way to go before it is viable for first class support. Though in the next release you will not have to do df.to_pandas; baby steps!
Hi @has2k1 - would you be open to exploring using Narwhals to achieve cross-library compatibility? This is what Altair have done in their latest release
Happy to try putting together a PR if you'd be open to this!
Reacted by Bruno Conde Kind, Francesco Bruzzesi, Edoardo Abati, Dea María Léon, Luciano, Magdalena Kowalczuk, Benji Nwangele, baggiponte, Aoi, Jon Rothbaum and 13 more
Reacted by Francesco Bruzzesi, Luciano, baggiponte, Aidos Kanapyanov, Julien Cornebise, Jakub Cierocki, Miha Gazvoda and 天然純真
Hi @has2k1 - would you be open to exploring using Narwhals to achieve cross-library compatibility? This is what Altair have done in their latest release
Happy to try putting together a PR if you'd be open to this!
Oh actually this could be lovely. We'd love to use plotnine internally but we migrated everything to Polars and it's much more handy to use a "polars-first" plotting lib.
Reacted by kdkavanagh, Daniel Borek, Francesco Bruzzesi and 天然純真
Any update on this? Is there anything we can do to help unblock progress?
Polars still does not support categorical semantics in a way that is usable for our needs. The long-standing issue remains unresolved, and a recent reinterpretation of categoricals has further broken compatibility with plotnine. The categorical set is now global to the execution environment rather than scoped to an individual column or Series, which is fundamentally incompatible with what we expect.
We require both nominal and ordinal categorical types to carry an explicit ordering and to be sortable according to that ordering. While assigning an order to nominal categoricals may at first seem unintuitive, it is essential for presentation semantics such as determining scale colour order and axis value ordering. i.e. Unlike purely mathematical categoricals, practical categoricals are both computed on and presented, and therefore must be designed to support both concerns.
I was more thinking about narwahls support :-) Isn't it something we can progressively do? By converting functions and methods one at a time (and eg flagging them with a decorator)? This should preserve existing behaviour while making steps towards this goal.
Polars support would definitely come through Narwhals and I did some exploration about 8 months back to find a starting point.But given the effort required I'm not motivated to go through with it if the outcome only preserves current behaviour.
That said I have wanted to have first class support for polars since it came out.
Activity
TyberiusPrime commentedon Aug 11, 2022
I suppose the sensible way here would be to check if it has a 'to_pandas' (or even a to_frame()?) method,
and then convert it - I don't think plotnine should require polars support just to check for it's classes.
has2k1 commentedon Sep 13, 2022
polars is the future but there are still some way to go before it is viable for first class support. Though in the next release you will not have to do
df.to_pandas; baby steps!zykezero commentedon Oct 11, 2022
Was this update put in? I was using polars with plotnine and I didn't encounter an error.
Hoeze commentedon Mar 14, 2023
You will likely run into errors with missing data because Polars has first-class nullable types support, while Plotnine does not understand these.
MarcoGorelli commentedon Aug 12, 2024
Hi @has2k1 - would you be open to exploring using Narwhals to achieve cross-library compatibility? This is what Altair have done in their latest release
Happy to try putting together a PR if you'd be open to this!
baggiponte commentedon Aug 14, 2024
Oh actually this could be lovely. We'd love to use plotnine internally but we migrated everything to Polars and it's much more handy to use a "polars-first" plotting lib.
AlexandreDecan commentedon Dec 21, 2025
Any update on this? Is there anything we can do to help?
has2k1 commentedon Dec 22, 2025
Polars still does not support categorical semantics in a way that is usable for our needs. The long-standing issue remains unresolved, and a recent reinterpretation of categoricals has further broken compatibility with plotnine. The categorical set is now global to the execution environment rather than scoped to an individual column or Series, which is fundamentally incompatible with what we expect.
We require both nominal and ordinal categorical types to carry an explicit ordering and to be sortable according to that ordering. While assigning an order to nominal categoricals may at first seem unintuitive, it is essential for presentation semantics such as determining scale colour order and axis value ordering. i.e. Unlike purely mathematical categoricals, practical categoricals are both computed on and presented, and therefore must be designed to support both concerns.
AlexandreDecan commentedon Dec 22, 2025
I was more thinking about narwahls support :-) Isn't it something we can progressively do? By converting functions and methods one at a time (and eg flagging them with a decorator)? This should preserve existing behaviour while making steps towards this goal.
has2k1 commentedon Dec 22, 2025
Polars support would definitely come through Narwhals and I did some exploration about 8 months back to find a starting point.But given the effort required I'm not motivated to go through with it if the outcome only preserves current behaviour.
That said I have wanted to have first class support for polars since it came out.