pandas plotting backend?
See original GitHub issuePlotly has toplevel .plot
function which allows for a pandas plotting backend to exist:
Like this, if people have plotly
installed, they can do:
pd.set_option('plotting.backend', 'plotly')
and then df.plot.line(x=x, y=y)
will defer to plotly.express.line(data_frame=df, x=x, y=y)
:
It’d be nice to be able to do
pd.set_option('plotting.backend', 'seaborn')
and then have df.plot.line(x=x, y=y)
defer to seaborn.line(data=df, x=x, y=y)
Would you be open to these ~150 lines of code or so to allow seaborn
to be set as a plotting backend in pandas? Check the link above to see what it looks like in plotly
. I’d be happy to implement this, just checking if it’d be welcome
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Pandas plotting backend in Python
The Plotly plotting backend for Pandas is a more convenient way to invoke certain Plotly Express functions by chaining a .plot() call without...
Read more >python - Change pandas plotting backend to get interactive ...
You need pandas >= 0.25 to change the plotting backend of pandas. The available plotting backends are: matplotlib · hvplot >= 0.5.1
Read more >pandas.DataFrame.plot — pandas 1.5.2 documentation
Make plots of Series or DataFrame. Uses the backend specified by the option plotting.backend . By default, matplotlib is used. Parameters.
Read more >Plotting in Pandas Just Got Prettier - Towards Data Science
Bokeh backend. Bokeh is another Python plotting library that provides rich and interactive visualisations. The visualisations can be viewed in a ...
Read more >Bokeh Plotting Backend for Pandas and GeoPandas - GitHub
Pandas -Bokeh provides a Bokeh plotting backend for Pandas, GeoPandas and Pyspark DataFrames, similar to the already existing Visualization feature of Pandas ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh yes, the
plotly
backend deliberately does not aim to be arg-compatible with the builtin backend! This is what I put in the docs:That’s tricky because sometimes things aren’t in seaborn because they’re in pandas, e.g. “area plots” https://github.com/mwaskom/seaborn/issues/2410. In cases where a “seaborn version” of a plot type wouldn’t add anything beyond what an existing pandas (or matplotlib) implementation can do, I’m usually reluctant to add it, especially if it doesn’t fit nicely into seaborn’s existing plot taxonomy. It’s hard to see a case for pandas fully deprecating area and (alas) pie charts — they’re fundamental for the kinds of applications that many people use pandas for.
In fairness, though, the plotly layer is light in part because a lot of stuff just doesn’t work. e.g. for a few quick things i tried, both wide data and subplots raise. And in the example you linked to above, the
by
andbins
(bins!!) parameters for histograms are simply ignored, as withs
andc
for scatter. I suppose it’s fine for the plotly backend to not be feature-complete with the matplotlib backend, but you’d be talking about deprecation of major functionality if you took the same approach and didn’t include anything in the “seaborn” backend that wasn’t a simple parameter name translation.