Skip to content

Commit

Permalink
DOC: add plotting backends in visualization.rst (#31066)
Browse files Browse the repository at this point in the history
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
  • Loading branch information
rushabh-v and jorisvandenbossche authored Feb 5, 2020
1 parent 0b6debf commit cc4a3e9
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions doc/source/user_guide/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1641,3 +1641,46 @@ when plotting a large number of points.
:suppress:
plt.close('all')
Plotting backends
-----------------

Starting in version 0.25, pandas can be extended with third-party plotting backends. The
main idea is letting users select a plotting backend different than the provided
one based on Matplotlib.

This can be done by passsing 'backend.module' as the argument ``backend`` in ``plot``
function. For example:

.. code-block:: python
>>> Series([1, 2, 3]).plot(backend='backend.module')
Alternatively, you can also set this option globally, do you don't need to specify
the keyword in each ``plot`` call. For example:

.. code-block:: python
>>> pd.set_option('plotting.backend', 'backend.module')
>>> pd.Series([1, 2, 3]).plot()
Or:

.. code-block:: python
>>> pd.options.plotting.backend = 'backend.module'
>>> pd.Series([1, 2, 3]).plot()
This would be more or less equivalent to:

.. code-block:: python
>>> import backend.module
>>> backend.module.plot(pd.Series([1, 2, 3]))
The backend module can then use other visualization tools (Bokeh, Altair, hvplot,...)
to generate the plots. Some libraries implementing a backend for pandas are listed
on the ecosystem :ref:`ecosystem.visualization` page.

Developers guide can be found at
https://dev.pandas.io/docs/development/extending.html#plotting-backends

0 comments on commit cc4a3e9

Please sign in to comment.