Skip to content

Commit cc4a3e9

Browse files
DOC: add plotting backends in visualization.rst (#31066)
Co-authored-by: Joris Van den Bossche <[email protected]>
1 parent 0b6debf commit cc4a3e9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

doc/source/user_guide/visualization.rst

+43
Original file line numberDiff line numberDiff line change
@@ -1641,3 +1641,46 @@ when plotting a large number of points.
16411641
:suppress:
16421642
16431643
plt.close('all')
1644+
1645+
Plotting backends
1646+
-----------------
1647+
1648+
Starting in version 0.25, pandas can be extended with third-party plotting backends. The
1649+
main idea is letting users select a plotting backend different than the provided
1650+
one based on Matplotlib.
1651+
1652+
This can be done by passsing 'backend.module' as the argument ``backend`` in ``plot``
1653+
function. For example:
1654+
1655+
.. code-block:: python
1656+
1657+
>>> Series([1, 2, 3]).plot(backend='backend.module')
1658+
1659+
Alternatively, you can also set this option globally, do you don't need to specify
1660+
the keyword in each ``plot`` call. For example:
1661+
1662+
.. code-block:: python
1663+
1664+
>>> pd.set_option('plotting.backend', 'backend.module')
1665+
>>> pd.Series([1, 2, 3]).plot()
1666+
1667+
Or:
1668+
1669+
.. code-block:: python
1670+
1671+
>>> pd.options.plotting.backend = 'backend.module'
1672+
>>> pd.Series([1, 2, 3]).plot()
1673+
1674+
This would be more or less equivalent to:
1675+
1676+
.. code-block:: python
1677+
1678+
>>> import backend.module
1679+
>>> backend.module.plot(pd.Series([1, 2, 3]))
1680+
1681+
The backend module can then use other visualization tools (Bokeh, Altair, hvplot,...)
1682+
to generate the plots. Some libraries implementing a backend for pandas are listed
1683+
on the ecosystem :ref:`ecosystem.visualization` page.
1684+
1685+
Developers guide can be found at
1686+
https://dev.pandas.io/docs/development/extending.html#plotting-backends

0 commit comments

Comments
 (0)