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

Skip to content

Commit 1620a12

Browse files
committed
DOC: move text
1 parent 087b9f6 commit 1620a12

32 files changed

+101
-70
lines changed

.flake8

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ per-file-ignores =
6767
galleries/tutorials/introductory/animation_tutorial.py: E501
6868
galleries/tutorials/introductory/images.py: E501
6969
galleries/tutorials/introductory/pyplot.py: E402, E501
70-
galleries/tutorials/text/annotations.py: E402, E501
71-
galleries/tutorials/text/mathtext.py: E501
72-
galleries/tutorials/text/text_intro.py: E402
73-
galleries/tutorials/text/text_props.py: E501
70+
galleries/users_explain/text/annotations.py: E402, E501
71+
galleries/users_explain/text/mathtext.py: E501
72+
galleries/users_explain/text/text_intro.py: E402
73+
galleries/users_explain/text/text_props.py: E501
7474

7575
galleries/examples/animation/frame_grabbing_sgskip.py: E402
7676
galleries/examples/images_contours_and_fields/tricontour_demo.py: E201

doc/devel/MEP/MEP29.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Improvements
5454
to use the html.parser from the standard library.
5555

5656
* Computation of text fragment positions could benefit from the OffsetFrom
57-
class. See for example item 5 in `Using Complex Coordinates with Annotations <https://matplotlib.org/devdocs/tutorials/text/annotations.html#using-complex-coordinates-with-annotations>`_
57+
class. See for example item 5 in `Using Complex Coordinates with Annotations <https://matplotlib.org/devdocs/users/explain/text/annotations.html#using-complex-coordinates-with-annotations>`_
5858

5959
Problems
6060
--------

doc/users/prev_whats_new/whats_new_0.99.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Jae-Joon Lee has written two new guides :doc:`/tutorials/intermediate/legend_gui
1515
and :ref:`plotting-guide-annotation`. Michael Sarahan has written
1616
:doc:`/tutorials/introductory/images`. John Hunter has written two new tutorials on
1717
working with paths and transformations: :doc:`/tutorials/advanced/path_tutorial` and
18-
:doc:`transforms_tutorial`.
18+
:ref:`transforms_tutorial`.
1919

2020
.. _whats-new-mplot3d:
2121

doc/users/prev_whats_new/whats_new_1.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PGF/TikZ backend
3939
Peter Würtz wrote a backend that allows matplotlib to export figures as
4040
drawing commands for LaTeX. These can be processed by PdfLaTeX, XeLaTeX or
4141
LuaLaTeX using the PGF/TikZ package. Usage examples and documentation are
42-
found in :doc:`/tutorials/text/pgf`.
42+
found in :ref:`pgf`.
4343

4444
.. image:: /_static/pgf_preamble.*
4545

doc/users/prev_whats_new/whats_new_3.7.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,4 @@ New & Improved Narrative Documentation
448448
* Brand new :doc:`Animations </tutorials/introductory/animation_tutorial>` tutorial.
449449
* New grouped and stacked `bar chart <../../gallery/index.html#lines_bars_and_markers>`_ examples.
450450
* New section for new contributors and reorganized git instructions in the :ref:`contributing guide<contributing>`.
451-
* Restructured :doc:`/tutorials/text/annotations` tutorial.
451+
* Restructured :ref:`annotations` tutorial.

galleries/examples/lines_bars_and_markers/marker_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def split_list(a_list):
101101
# Markers created from TeX symbols
102102
# ================================
103103
#
104-
# Use :doc:`MathText </tutorials/text/mathtext>`, to use custom marker symbols,
104+
# Use :ref:`MathText <mathtext>`, to use custom marker symbols,
105105
# like e.g. ``"$\u266B$"``. For an overview over the STIX font symbols refer
106106
# to the `STIX font table <http://www.stixfonts.org/allGlyphs.html>`_.
107107
# Also see the :doc:`/gallery/text_labels_and_annotations/stix_fonts_demo`.

galleries/examples/pyplots/pyplot_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
objects can be placed in the axes using `~.pyplot.text`.
99
1010
You can use TeX-like mathematical typesetting in all texts; see also
11-
:doc:`/tutorials/text/mathtext`.
11+
:ref:`mathtext`.
1212
1313
.. redirect-from:: /gallery/pyplots/pyplot_mathtext
1414
"""

galleries/examples/shapes_and_collections/artist_reference.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""
2+
.. _artist_reference:
3+
24
================================
35
Reference for Matplotlib artists
46
================================

galleries/examples/text_labels_and_annotations/annotate_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
This example shows how to use different coordinate systems for annotations.
77
For a complete overview of the annotation capabilities, also see the
8-
:doc:`annotation tutorial</tutorials/text/annotations>`.
8+
:ref:`annotation tutorial<annotations>`.
99
1010
.. redirect-from:: /gallery/pyplots/annotate_transform
1111
"""

galleries/examples/text_labels_and_annotations/annotation_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
coordinates. We modify the defaults of the arrow, to "shrink" it.
88
99
For a complete overview of the annotation capabilities, also see the
10-
:doc:`annotation tutorial</tutorials/text/annotations>`.
10+
:ref:`annotation tutorial<annotations>`.
1111
1212
.. redirect-from:: /gallery/pyplots/annotation_basic
1313
"""

galleries/examples/text_labels_and_annotations/annotation_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
This includes highlighting specific points of interest and using various
88
visual tools to call attention to this point. For a more complete and in-depth
99
description of the annotation and text tools in Matplotlib, see the
10-
:doc:`tutorial on annotation </tutorials/text/annotations>`.
10+
:ref:`tutorial on annotation <annotations>`.
1111
"""
1212

1313
import matplotlib.pyplot as plt

galleries/examples/text_labels_and_annotations/annotation_polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This example shows how to create an annotation on a polar graph.
77
88
For a complete overview of the annotation capabilities, also see the
9-
:doc:`annotation tutorial</tutorials/text/annotations>`.
9+
:ref:`annotations`.
1010
1111
.. redirect-from:: /gallery/pyplots/annotation_polar
1212
"""

galleries/examples/text_labels_and_annotations/font_family_rc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
family names of fonts installed on user's system, or generic-families
88
(e.g., 'serif', 'sans-serif', 'monospace', 'fantasy' or 'cursive'),
99
or a combination of both.
10-
(see :doc:`font tutorial </tutorials/text/text_props>`)
10+
(see :ref:`text_props`)
1111
1212
In the example below, we are overriding the default sans-serif generic family
1313
to include a specific (Tahoma) font. (Note that the best way to achieve this

galleries/examples/text_labels_and_annotations/tex_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
You can use TeX to render all of your Matplotlib text by setting
77
:rc:`text.usetex` to True. This requires that you have TeX and the other
8-
dependencies described in the :doc:`/tutorials/text/usetex` tutorial properly
8+
dependencies described in the :ref:`usetex` tutorial properly
99
installed on your system. Matplotlib caches processed TeX expressions, so that
1010
only the first occurrence of an expression triggers a TeX compilation. Later
1111
occurrences reuse the rendered image from the cache and are thus faster.

galleries/examples/widgets/textbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
user presses enter in the textbox or leaves the textbox.
1010
1111
Note: The `matplotlib.widgets.TextBox` widget is different from the following
12-
static elements: :doc:`/tutorials/text/annotations` and
12+
static elements: :ref:`annotations` and
1313
:doc:`/gallery/text_labels_and_annotations/placing_text_boxes`.
1414
"""
1515

galleries/tutorials/introductory/pyplot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def f(t):
325325
#
326326
# `~.pyplot.text` can be used to add text in an arbitrary location, and
327327
# `~.pyplot.xlabel`, `~.pyplot.ylabel` and `~.pyplot.title` are used to add
328-
# text in the indicated locations (see :doc:`/tutorials/text/text_intro` for a
328+
# text in the indicated locations (see :ref:`text_intro` for a
329329
# more detailed example)
330330

331331
mu, sigma = 100, 15
@@ -350,7 +350,7 @@ def f(t):
350350
#
351351
# t = plt.xlabel('my data', fontsize=14, color='red')
352352
#
353-
# These properties are covered in more detail in :doc:`/tutorials/text/text_props`.
353+
# These properties are covered in more detail in :ref:`text_props`.
354354
#
355355
#
356356
# Using mathematical expressions in text
@@ -366,11 +366,11 @@ def f(t):
366366
# that the string is a *raw* string and not to treat backslashes as
367367
# python escapes. matplotlib has a built-in TeX expression parser and
368368
# layout engine, and ships its own math fonts -- for details see
369-
# :doc:`/tutorials/text/mathtext`. Thus, you can use mathematical text across
369+
# :ref:`mathtext`. Thus, you can use mathematical text across
370370
# platforms without requiring a TeX installation. For those who have LaTeX
371371
# and dvipng installed, you can also use LaTeX to format your text and
372372
# incorporate the output directly into your display figures or saved
373-
# postscript -- see :doc:`/tutorials/text/usetex`.
373+
# postscript -- see :ref:`usetex`.
374374
#
375375
#
376376
# Annotating text

galleries/users_explain/artists/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ constructor; optional arguments are passed as keyword arguments.
174174

175175
Note that when we add an Artist manually like this, it doesn't necessarily
176176
adjust the axis limits like most of the helper methods do, so the Artists can
177-
be clipped, as is the case above for the `clipped_circle` patch.
177+
be clipped, as is the case above for the ``clipped_circle`` patch.
178178

179-
See :doc:`artist_reference` for other patches.
179+
See :ref:`artist_reference` for other patches.
180180

181181
Removing Artists
182182
~~~~~~~~~~~~~~~~

galleries/users_explain/axes/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Note that text can also be added to axes using `~.axes.Axes.text`, and `~.axes.A
128128
Axes limits, scales, and ticking
129129
--------------------------------
130130

131-
Each Axes has two (or more) `Axis` objects, that can be accessed via `~.axes.Axes.xaxis` and `~.axes.Axes.yaxis` properties. These have substantial number of methods on them, and for highly customizable Axis-es it is useful to read more about that API (:doc:`axis/index`). However, the Axes class offers a number of helpers for the most common of these methods. Indeed, the `~.axes.Axes.set_xlabel`, discussed above, is a helper for the `~.Axis.set_label_text`.
131+
Each Axes has two (or more) `~.axis.Axis` objects, that can be accessed via :attr:`~matplotlib.axes.Axes.xaxis` and :attr:`~matplotlib.axes.Axes.yaxis` properties. These have substantial number of methods on them, and for highly customizable Axis-es it is useful to read more about that API (:doc:`axis/index`). However, the Axes class offers a number of helpers for the most common of these methods. Indeed, the `~.axes.Axes.set_xlabel`, discussed above, is a helper for the `~.Axis.set_label_text`.
132132

133133
Other important methods set the extent on the axes (`~.axes.Axes.set_xlim`, `~.axes.Axes.set_ylim`), or more fundamentally the scale of the axes. So for instance, we can make an Axis have a logarithmic scale, and zoom in on a sub-portion of the data:
134134

galleries/users_explain/fonts.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Matplotlib needs fonts to work with its text engine, some of which are shipped
77
alongside the installation. The default font is `DejaVu Sans
88
<https://dejavu-fonts.github.io>`_ which covers most European writing systems.
99
However, users can configure the default fonts, and provide their own custom
10-
fonts. See :doc:`Customizing text properties </tutorials/text/text_props>` for
10+
fonts. See :ref:`Customizing text properties <text_props>` for
1111
details and :ref:`font-nonlatin` in particular for glyphs not supported by
1212
DejaVu Sans.
1313

1414
Matplotlib also provides an option to offload text rendering to a TeX engine
15-
(``usetex=True``), see :doc:`Text rendering with LaTeX
16-
</tutorials/text/usetex>`.
15+
(``usetex=True``), see :ref:`Text rendering with LaTeX
16+
<usetex>`.
1717

1818
Fonts in PDF and PostScript
1919
---------------------------

galleries/users_explain/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
.. redirect-from:: /users/explain
44

5-
Explanations
6-
------------
5+
Using Matplotlib
6+
----------------
77

88
.. toctree::
9-
:maxdepth: 2
9+
:maxdepth: 1
1010

1111
quick_start
1212
figure/index
1313
axes/index
1414
artists/index
1515
colors/index
16+
text/index
1617
backends.rst
1718
fonts.rst
1819
event_handling.rst

galleries/users_explain/quick_start.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def my_plotter(ax, data1, data2, param_dict):
297297
# --------------------
298298
#
299299
# `~.Axes.set_xlabel`, `~.Axes.set_ylabel`, and `~.Axes.set_title` are used to
300-
# add text in the indicated locations (see :doc:`/tutorials/text/text_intro`
300+
# add text in the indicated locations (see :ref:`text_intro`
301301
# for more discussion). Text can also be directly added to plots using
302302
# `~.Axes.text`:
303303

@@ -322,7 +322,7 @@ def my_plotter(ax, data1, data2, param_dict):
322322
# t = ax.set_xlabel('my data', fontsize=14, color='red')
323323
#
324324
# These properties are covered in more detail in
325-
# :doc:`/tutorials/text/text_props`.
325+
# :ref:`text_props`.
326326
#
327327
# Using mathematical expressions in text
328328
# --------------------------------------
@@ -337,9 +337,9 @@ def my_plotter(ax, data1, data2, param_dict):
337337
# *raw* string and not to treat backslashes as python escapes.
338338
# Matplotlib has a built-in TeX expression parser and
339339
# layout engine, and ships its own math fonts – for details see
340-
# :doc:`/tutorials/text/mathtext`. You can also use LaTeX directly to format
340+
# :ref:`mathtext`. You can also use LaTeX directly to format
341341
# your text and incorporate the output directly into your display figures or
342-
# saved postscript – see :doc:`/tutorials/text/usetex`.
342+
# saved postscript – see :ref:`usetex`.
343343
#
344344
# Annotations
345345
# -----------
@@ -552,7 +552,7 @@ def my_plotter(ax, data1, data2, param_dict):
552552
# a ScalarMappable (where they get their information about the norm and
553553
# colormap) and usually steal space from a parent Axes. Placement of
554554
# colorbars can be complex: see
555-
# :doc:`/gallery/subplots_axes_and_figures/colorbar_placement` for
555+
# :ref:`colorbar_placement` for
556556
# details. You can also change the appearance of colorbars with the
557557
# *extend* keyword to add arrows to the ends, and *shrink* and *aspect* to
558558
# control the size. Finally, the colorbar will have default locators

galleries/tutorials/text/README.txt renamed to galleries/users_explain/text/README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. redirect-from:: /tutorials/text
2+
13
.. _tutorials-text:
24

35
Text

galleries/tutorials/text/annotations.py renamed to galleries/users_explain/text/annotations.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
.. redirect-from:: /gallery/userdemo/anchored_box04
77
.. redirect-from:: /gallery/userdemo/annotate_simple_coord01
88
.. redirect-from:: /gallery/userdemo/annotate_simple_coord03
9+
.. redirect-from:: /tutorials/text/annotations
10+
11+
.. _annotations:
912
1013
Annotations
1114
===========
@@ -236,8 +239,8 @@
236239
# Square ``square`` pad=0.3
237240
# ========== ============== ==========================
238241
#
239-
# .. figure:: ../../gallery/shapes_and_collections/images/sphx_glr_fancybox_demo_001.png
240-
# :target: ../../gallery/shapes_and_collections/fancybox_demo.html
242+
# .. figure:: /gallery/shapes_and_collections/images/sphx_glr_fancybox_demo_001.png
243+
# :target: /gallery/shapes_and_collections/fancybox_demo.html
241244
# :align: center
242245
#
243246
# The patch object (box) associated with the text can be accessed using::
@@ -326,8 +329,8 @@ def custom_box_style(x0, y0, width, height, mutation_size):
326329
# 4. The path is transmuted to an arrow patch, as specified by the *arrowstyle*
327330
# parameter.
328331
#
329-
# .. figure:: ../../gallery/userdemo/images/sphx_glr_annotate_explain_001.png
330-
# :target: ../../gallery/userdemo/annotate_explain.html
332+
# .. figure:: /gallery/userdemo/images/sphx_glr_annotate_explain_001.png
333+
# :target: /gallery/userdemo/annotate_explain.html
331334
# :align: center
332335
#
333336
# The creation of the connecting path between two points is controlled by
@@ -352,8 +355,8 @@ def custom_box_style(x0, y0, width, height, mutation_size):
352355
# example below. (Warning: The behavior of the ``bar`` style is currently not
353356
# well-defined and may be changed in the future).
354357
#
355-
# .. figure:: ../../gallery/userdemo/images/sphx_glr_connectionstyle_demo_001.png
356-
# :target: ../../gallery/userdemo/connectionstyle_demo.html
358+
# .. figure:: /gallery/userdemo/images/sphx_glr_connectionstyle_demo_001.png
359+
# :target: /gallery/userdemo/connectionstyle_demo.html
357360
# :align: center
358361
#
359362
# The connecting path (after clipping and shrinking) is then mutated to
@@ -376,8 +379,8 @@ def custom_box_style(x0, y0, width, height, mutation_size):
376379
# ``wedge`` tail_width=0.3,shrink_factor=0.5
377380
# ========== =============================================
378381
#
379-
# .. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_fancyarrow_demo_001.png
380-
# :target: ../../gallery/text_labels_and_annotations/fancyarrow_demo.html
382+
# .. figure:: /gallery/text_labels_and_annotations/images/sphx_glr_fancyarrow_demo_001.png
383+
# :target: /gallery/text_labels_and_annotations/fancyarrow_demo.html
381384
# :align: center
382385
#
383386
# Some arrowstyles only work with connection styles that generate a
@@ -688,17 +691,17 @@ def custom_box_style(x0, y0, width, height, mutation_size):
688691
# Here, we added the `.ConnectionPatch` to the *figure*
689692
# (with `~.Figure.add_artist`) rather than to either axes. This ensures that
690693
# the ConnectionPatch artist is drawn on top of both axes, and is also necessary
691-
# when using :doc:`constrained_layout
692-
# <:ref:`constrainedlayout_guide`>` for positioning the axes.
694+
# when using :ref:`constrained_layout <constrainedlayout_guide>`
695+
# for positioning the axes.
693696
#
694697
# Zoom effect between Axes
695698
# ~~~~~~~~~~~~~~~~~~~~~~~~
696699
#
697700
# `mpl_toolkits.axes_grid1.inset_locator` defines some patch classes useful for
698701
# interconnecting two axes.
699702
#
700-
# .. figure:: ../../gallery/subplots_axes_and_figures/images/sphx_glr_axes_zoom_effect_001.png
701-
# :target: ../../gallery/subplots_axes_and_figures/axes_zoom_effect.html
703+
# .. figure:: /gallery/subplots_axes_and_figures/images/sphx_glr_axes_zoom_effect_001.png
704+
# :target: /gallery/subplots_axes_and_figures/axes_zoom_effect.html
702705
# :align: center
703706
#
704707
# The code for this figure is at

galleries/tutorials/text/mathtext.py renamed to galleries/users_explain/text/mathtext.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
r"""
2+
3+
.. redirect-from:: /tutorials/text/mathtext
4+
5+
.. _mathtext:
6+
27
Writing mathematical expressions
38
================================
49
@@ -10,7 +15,7 @@
1015
is a fairly direct adaptation of the layout algorithms in Donald Knuth's
1116
TeX, so the quality is quite good (Matplotlib also provides a ``usetex``
1217
option for those who do want to call out to TeX to generate their text; see
13-
:doc:`/tutorials/text/usetex`).
18+
:ref:`usetex`).
1419
1520
Any text element can use math text. You should use raw strings (precede the
1621
quotes with an ``'r'``), and surround the math text with dollar signs ($), as
@@ -50,7 +55,7 @@
5055
5156
have special meaning outside of math mode in TeX. Therefore, these
5257
characters will behave differently depending on :rc:`text.usetex`. See the
53-
:doc:`usetex tutorial </tutorials/text/usetex>` for more information.
58+
:ref:`usetex tutorial <usetex>` for more information.
5459
5560
Subscripts and superscripts
5661
---------------------------
@@ -354,7 +359,7 @@
354359
-------
355360
Here is an example illustrating many of these features in context.
356361
357-
.. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_mathtext_demo_001.png
358-
:target: ../../gallery/text_labels_and_annotations/mathtext_demo.html
362+
.. figure:: /gallery/text_labels_and_annotations/images/sphx_glr_mathtext_demo_001.png
363+
:target: /gallery/text_labels_and_annotations/mathtext_demo.html
359364
:align: center
360365
"""

0 commit comments

Comments
 (0)