1

In Pandas, the list of available plotting backends changes and get updated over time, but is there a function/attribute to actually print them?

https://pandas.pydata.org/pandas-docs/stable/development/extending.html#plotting-backends

I understand I can query the existing one like this:

print(pd.options.plotting.backend)
matplotlib

Or, for example, if I need all the templates in plotly, I can write:

import plotly.io as pio
pio.templates

And then I get:

Default template: 'plotly'
Available templates:
    ['ggplot2', 'seaborn', 'simple_white', 'plotly',
     'plotly_white', 'plotly_dark', 'presentation', 'xgridoff',
     'ygridoff', 'gridon', 'none']

Is is possible to get such information for the available pandas plotting backends, too?

JanosLaszlo
  • 189
  • 1
  • 5

2 Answers2

1

Inspecting pandas internal function _load_backend in the module pandas.plotting._core.py you can print some of the available plotting backed using the code:

from importlib.metadata import entry_points
eps = entry_points()
if "pandas_plotting_backends" in eps:
    print([entry_point.name for entry_point in eps["pandas_plotting_backends"])

This list is partial because if you try to load a backend which doesn't appear in this list than it will fallback is to use importlib.import_module.

Hagai Drory
  • 141
  • 1
  • 5
0

I don't know a way of getting a list, but in the question/answer here are the available backends that I know of:

Which plotting backends does pandas support for DataFrames?

In short:
matplotlib, plotly, altair, holoviews, hvplot, pandas_bokeh.

You need to have the plotting library installed for it to work as a plotting backend.

You can set the backend for the whole session as follows:

pd.options.plotting.backend = 'plotly'

Or for just one plot like this:

df.plot(backend='plotly')
Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96