Skip to content

Backport PR #24054 on branch v3.6.x ( DOC: Move OO-examples from pyplot section) #24077

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
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions doc/users/faq/howto_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ multiple ways to fix this:
- tight layout (:doc:`/tutorials/intermediate/tight_layout_guide`)

- Calculate good values from the size of the plot elements yourself
(:doc:`/gallery/pyplots/auto_subplots_adjust`)
(:doc:`/gallery/subplots_axes_and_figures/auto_subplots_adjust`)

.. _howto-align-label:

Expand All @@ -203,8 +203,8 @@ behavior by specifying the coordinates of the label. The example
below shows the default behavior in the left subplots, and the manual
setting in the right subplots.

.. figure:: ../../gallery/pyplots/images/sphx_glr_align_ylabels_001.png
:target: ../../gallery/pyplots/align_ylabels.html
.. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_align_ylabels_001.png
:target: ../../gallery/text_labels_and_annotations/align_ylabels.html
:align: center
:scale: 50

Expand Down
2 changes: 2 additions & 0 deletions examples/pyplots/fig_x.py → examples/misc/fig_x.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
=======================

Adding lines to a figure without any axes.

.. redirect-from:: /gallery/pyplots/fig_x
"""

import matplotlib.pyplot as plt
Expand Down
89 changes: 0 additions & 89 deletions examples/pyplots/boxplot_demo_pyplot.py

This file was deleted.

42 changes: 0 additions & 42 deletions examples/pyplots/fig_axes_labels_simple.py

This file was deleted.

21 changes: 0 additions & 21 deletions examples/pyplots/pyplot_formatstr.py

This file was deleted.

9 changes: 7 additions & 2 deletions examples/pyplots/pyplot_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@

A very simple pyplot where a list of numbers are plotted against their
index. Creates a straight line due to the rate of change being 1 for
both the X and Y axis.
both the X and Y axis. Use a format string (here, 'o-r') to set the
markers (circles), linestyle (solid line) and color (red).

.. redirect-from:: /gallery/pyplots/fig_axes_labels_simple
.. redirect-from:: /gallery/pyplots/pyplot_formatstr
"""
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])

plt.plot([1, 2, 3, 4], 'o-r')
plt.ylabel('some numbers')
plt.show()

Expand Down
63 changes: 0 additions & 63 deletions examples/pyplots/text_layout.py

This file was deleted.

2 changes: 2 additions & 0 deletions examples/statistics/boxplot_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
The following examples show off how to visualize boxplots with
Matplotlib. There are many options to control their appearance and
the statistics that they use to summarize the data.

.. redirect-from:: /gallery/pyplots/boxplot_demo_pyplot
"""

import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
This function is executed after the figure has been drawn. It can now check
if the subplot leaves enough room for the text. If not, the subplot parameters
are updated and second draw is triggered.

.. redirect-from:: /gallery/pyplots/auto_subplots_adjust
"""

import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Two methods are shown here, one using a short call to `.Figure.align_ylabels`
and the second a manual way to align the labels.

.. redirect-from:: /gallery/pyplots/align_ylabels
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
This example shows how to use different coordinate systems for annotations.
For a complete overview of the annotation capabilities, also see the
:doc:`annotation tutorial</tutorials/text/annotations>`.

.. redirect-from:: /gallery/pyplots/annotate_transform
"""

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

For a complete overview of the annotation capabilities, also see the
:doc:`annotation tutorial</tutorials/text/annotations>`.

.. redirect-from:: /gallery/pyplots/annotation_basic
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

For a complete overview of the annotation capabilities, also see the
:doc:`annotation tutorial</tutorials/text/annotations>`.

.. redirect-from:: /gallery/pyplots/annotation_polar
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
2 changes: 2 additions & 0 deletions examples/text_labels_and_annotations/text_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Texts are aligned relative to their anchor point depending on the properties
``horizontalalignment`` and ``verticalalignment``.

.. redirect-from:: /gallery/pyplots/text_layout

.. plot::

import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
=============

Plotting text of many different kinds.

.. redirect-from:: /gallery/pyplots/text_commands
"""

import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
============

Use a `~.ticker.FormatStrFormatter` to prepend dollar signs on y axis labels.

.. redirect-from:: /gallery/pyplots/dollar_ticks
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
=========================

Customize the background, labels and ticks of a simple plot.

.. redirect-from:: /gallery/pyplots/fig_axes_customize_simple
"""

import matplotlib.pyplot as plt
Expand Down
1 change: 1 addition & 0 deletions examples/ticks/tick-formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
is formatted as a string.

This example illustrates the usage and effect of the most common formatters.

"""

import matplotlib.pyplot as plt
Expand Down
2 changes: 1 addition & 1 deletion tutorials/intermediate/artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,6 @@ class in the Matplotlib API, and the one you will be working with most
# dollar signs and colors them green on the right side of the yaxis.
#
#
# .. include:: ../../gallery/pyplots/dollar_ticks.rst
# .. include:: ../../gallery/ticks/dollar_ticks.rst
# :start-after: y axis labels.
# :end-before: .. admonition:: References
8 changes: 4 additions & 4 deletions tutorials/text/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
# *xy* and the location of the text *xytext*. Both of these
# arguments are ``(x, y)`` tuples.
#
# .. figure:: ../../gallery/pyplots/images/sphx_glr_annotation_basic_001.png
# :target: ../../gallery/pyplots/annotation_basic.html
# .. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_annotation_basic_001.png
# :target: ../../gallery/text_labels_and_annotations/annotation_basic.html
# :align: center
#
# In this example, both the *xy* (arrow tip) and *xytext* locations
Expand Down Expand Up @@ -86,8 +86,8 @@
# *fontsize* are passed from `~matplotlib.axes.Axes.annotate` to the
# ``Text`` instance.
#
# .. figure:: ../../gallery/pyplots/images/sphx_glr_annotation_polar_001.png
# :target: ../../gallery/pyplots/annotation_polar.html
# .. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_annotation_polar_001.png
# :target: ../../gallery/text_labels_and_annotations/annotation_polar.html
# :align: center
#
# For more on all the wild and wonderful things you can do with
Expand Down