@@ -34,23 +34,57 @@ using Matplotlib, and what :ref:`Backend <what-is-a-backend>` you are using.
3434Notebooks and IDEs
3535------------------
3636
37+ .. figure :: /_static/FigureInline.png
38+ :alt: Image of figure generated in Jupyter Notebook with inline backend.
39+ :width: 400
40+
41+ Screenshot of a `Jupyter Notebook <https://jupyter.org >`_, with a figure
42+ generated via the default `inline
43+ <https://github.com/ipython/matplotlib-inline> `_ backend.
44+
45+
3746If you are using a Notebook (e.g. `Jupyter <https://jupyter.org >`_) or an IDE
3847that renders Notebooks (PyCharm, VSCode, etc), then they have a backend that
3948will render the Matplotlib Figure when a code cell is executed. One thing to
4049be aware of is that the default Jupyter backend (``%matplotlib inline ``) will
4150by default trim or expand the figure size to have a tight box around Artists
42- added to the Figure (see :ref: `saving_figures `, below).
51+ added to the Figure (see :ref: `saving_figures `, below). If you use a backend
52+ other than the default "inline" backend, you will likely need to use an ipython
53+ "magic" like ``%matplotlib notebook `` for the Matplotlib :ref: `notebook
54+ <jupyter_notebooks_jupyterlab>` or ``%matplotlib widget `` for the `ipympl
55+ <https://matplotlib.org/ipympl/> `_ backend.
56+
57+ .. figure :: /_static/FigureNotebook.png
58+ :alt: Image of figure generated in Jupyter Notebook with notebook
59+ backend, including a toolbar.
60+ :width: 400
61+
62+ Screenshot of a Jupyter Notebook with an interactive figure generated via
63+ the ``%matplotlib notebook `` magic. Users should also try the similar
64+ `widget <https://matplotlib.org/ipympl/ >`_ backend if using `JupyterLab
65+ <https://jupyterlab.readthedocs.io/en/stable/> `_.
66+
67+
68+ .. seealso ::
69+ :ref: `interactive_figures `.
4370
4471Standalone scripts and interactive use
4572--------------------------------------
4673
4774If the user is on a client with a windowing system, there are a number of
4875:ref: `Backends <what-is-a-backend >` that can be used to render the Figure to
49- the screen, usually using a Python Qt, Tk, or Wx toolkit, though there is a native
50- MacOS backend as well . These are typically chosen either in the user's
51- :ref: ` matplotlibrc <customizing-with-matplotlibrc-files >`, or by calling
76+ the screen, usually using a Python Qt, Tk, or Wx toolkit, or the native MacOS
77+ backend. These are typically chosen either in the user's :ref: ` matplotlibrc
78+ <customizing-with-matplotlibrc-files>`, or by calling, for example,
5279``matplotlib.use('QtAgg') `` at the beginning of a session or script.
5380
81+ .. figure :: /_static/FigureQtAgg.png
82+ :alt: Image of figure generated from a script via the QtAgg backend.
83+ :width: 370
84+
85+ Screenshot of a Figure generated via a python script and shown using the
86+ QtAgg backend.
87+
5488When run from a script, or interactively (e.g. from an
5589`iPython shell <https://https://ipython.readthedocs.io/en/stable/ >`_) the Figure
5690will not be shown until we call ``plt.show() ``. The Figure will appear in
@@ -64,6 +98,9 @@ Note that if you are on a client that does not have access to a windowing
6498system, the Figure will fallback to being drawn using the "Agg" backend, and
6599cannot be viewed, though it can be :ref: `saved <saving_figures >`.
66100
101+ .. seealso ::
102+ :ref: `interactive_figures `.
103+
67104.. _creating_figures :
68105
69106Creating Figures
0 commit comments