Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Updates the galleries/tutorials/artists.py file in response to issue #28920 #29080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions galleries/tutorials/artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

There are three layers to the Matplotlib API.

* the :class:`matplotlib.backend_bases.FigureCanvas` is the area onto which
* the :class:`!matplotlib.backend_bases.FigureCanvas` is the area onto which
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the previous way of expression is not exactly great - there is just no class
matplotlib.backend_bases.FigureCanvas. We have a logical concept of FigureCanvas that's realized through the subclasses of FigureCanvasBase. Maybe

Suggested change
* the :class:`!matplotlib.backend_bases.FigureCanvas` is the area onto which
* the *FigureCanvas* (subclasses of `.FigureCanvasBase`) is the area onto which

And subsequently only use FigureCanvas as a given name (for the logical concept) without further highlighting.

Or better, switch to :term:`FigureCanvas` , but that'd require first setting up a gloassary #28889.

But we can also leave all this for later.

the figure is drawn
* the :class:`matplotlib.backend_bases.Renderer` is the object which knows how
to draw on the :class:`~matplotlib.backend_bases.FigureCanvas`
* the :class:`!matplotlib.backend_bases.Renderer` is the object which knows how
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as above: Renderer is a concept realized through the subclasses of RendererBase.

to draw on the :class:`!matplotlib.backend_bases.FigureCanvas`
* and the :class:`matplotlib.artist.Artist` is the object that knows how to use
a renderer to paint onto the canvas.

The :class:`~matplotlib.backend_bases.FigureCanvas` and
:class:`~matplotlib.backend_bases.Renderer` handle all the details of
The :class:`!matplotlib.backend_bases.FigureCanvas` and
:class:`!matplotlib.backend_bases.Renderer` handle all the details of
talking to user interface toolkits like `wxPython
<https://www.wxpython.org>`_ or drawing languages like PostScript®, and
the ``Artist`` handles all the high level constructs like representing
Expand Down Expand Up @@ -156,12 +156,10 @@ class in the Matplotlib API, and the one you will be working with most
# (the standard white box with black edges in the typical Matplotlib
# plot, has a ``Rectangle`` instance that determines the color,
# transparency, and other properties of the Axes. These instances are
# stored as member variables :attr:`Figure.patch
# <matplotlib.figure.Figure.patch>` and :attr:`Axes.patch
# <matplotlib.axes.Axes.patch>` ("Patch" is a name inherited from
# MATLAB, and is a 2D "patch" of color on the figure, e.g., rectangles,
# circles and polygons). Every Matplotlib ``Artist`` has the following
# properties
# stored as member variables :attr:`!Figure.patch` and :attr:`!Axes.patch`
# ("Patch" is a name inherited from MATLAB, and is a 2D "patch"
# of color on the figure, e.g., rectangles, circles and polygons).
# Every Matplotlib ``Artist`` has the following properties
#
# ========== =================================================================
# Property Description
Expand Down Expand Up @@ -284,7 +282,7 @@ class in the Matplotlib API, and the one you will be working with most
# :class:`matplotlib.figure.Figure`, and it contains everything in the
# figure. The background of the figure is a
# :class:`~matplotlib.patches.Rectangle` which is stored in
# :attr:`Figure.patch <matplotlib.figure.Figure.patch>`. As
# :attr:`!Figure.patch`. As
# you add subplots (:meth:`~matplotlib.figure.Figure.add_subplot`) and
# Axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure
# these will be appended to the :attr:`Figure.axes
Expand Down Expand Up @@ -331,8 +329,7 @@ class in the Matplotlib API, and the one you will be working with most
#
# As with all ``Artist``\s, you can control this coordinate system by setting
# the transform property. You can explicitly use "figure coordinates" by
# setting the ``Artist`` transform to :attr:`fig.transFigure
# <matplotlib.figure.Figure.transFigure>`:
# setting the ``Artist`` transform to :attr:`!fig.transFigure`:

import matplotlib.lines as lines

Expand Down Expand Up @@ -375,7 +372,7 @@ class in the Matplotlib API, and the one you will be working with most
# customize the ``Artists`` it contains. Like the
# :class:`~matplotlib.figure.Figure`, it contains a
# :class:`~matplotlib.patches.Patch`
# :attr:`~matplotlib.axes.Axes.patch` which is a
# :attr:`!matplotlib.axes.Axes.patch` which is a
# :class:`~matplotlib.patches.Rectangle` for Cartesian coordinates and a
# :class:`~matplotlib.patches.Circle` for polar coordinates; this patch
# determines the shape, background and border of the plotting region::
Expand Down Expand Up @@ -408,8 +405,7 @@ class in the Matplotlib API, and the one you will be working with most
#
# Similarly, methods that create patches, like
# :meth:`~matplotlib.axes.Axes.bar` creates a list of rectangles, will
# add the patches to the :attr:`Axes.patches
# <matplotlib.axes.Axes.patches>` list:
# add the patches to the :attr:`!Axes.patches` list:
#
# .. sourcecode:: ipython
#
Expand Down Expand Up @@ -556,8 +552,8 @@ class in the Matplotlib API, and the one you will be working with most
# important ``Artist`` containers: the :class:`~matplotlib.axis.XAxis`
# and :class:`~matplotlib.axis.YAxis`, which handle the drawing of the
# ticks and labels. These are stored as instance variables
# :attr:`~matplotlib.axes.Axes.xaxis` and
# :attr:`~matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis``
# :attr:`!matplotlib.axes.Axes.xaxis` and
# :attr:`!matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis``
# containers will be detailed below, but note that the ``Axes`` contains
# many helper methods which forward calls on to the
# :class:`~matplotlib.axis.Axis` instances, so you often do not need to
Expand Down