Skip to content

Commit

Permalink
Merge pull request matplotlib#7398 from wgma00/master
Browse files Browse the repository at this point in the history
Moved python files from doc/pyplots to examples folder
  • Loading branch information
NelleV authored Nov 5, 2016
2 parents fd2e62d + ce661b0 commit 6709b59
Show file tree
Hide file tree
Showing 47 changed files with 77 additions and 34 deletions.
4 changes: 2 additions & 2 deletions doc/devel/documenting_mpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ script, this will be done automatically at build time to ensure that
the code that is included runs and produces the advertised figure.

The path should be relative to the ``doc`` directory. Any plots
specific to the documentation should be added to the ``doc/pyplots``
specific to the documentation should be added to the ``doc/mpl_examples/pyplots``
directory and committed to git. Plots from the ``examples`` directory
may be referenced through the symlink ``mpl_examples`` in the ``doc``
directory. e.g.::
Expand Down Expand Up @@ -310,7 +310,7 @@ git. Please also add a line to the README in doc/pyplots for any additional
requirements necessary to generate a new figure. Once these steps have been
taken, these figures can be included in the usual way::

.. plot:: pyplots/tex_unicode_demo.py
.. plot:: mpl_examples/pyplots/tex_unicode_demo.py
:include-source:

Examples
Expand Down
4 changes: 2 additions & 2 deletions doc/faq/howto_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Here is an example that gets a bounding box in relative figure coordinates
(0..1) of each of the labels and uses it to move the left of the subplots
over so that the tick labels fit in the figure

.. plot:: pyplots/auto_subplots_adjust.py
.. plot:: mpl_examples/pyplots/auto_subplots_adjust.py
:include-source:

.. _howto-ticks:
Expand Down Expand Up @@ -275,7 +275,7 @@ 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.

.. plot:: pyplots/align_ylabels.py
.. plot:: mpl_examples/pyplots/align_ylabels.py
:include-source:

.. _date-index-plots:
Expand Down
2 changes: 1 addition & 1 deletion doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def clean():
'mpl_examples/pylab_examples/*.png',
'mpl_examples/pylab_examples/*.pdf',
'mpl_examples/units/*.png',
'pyplots/tex_demo.png',
'mpl_examples/pyplots/tex_demo.png',
'_static/matplotlibrc',
'_templates/gallery.html',
'users/installing.rst']:
Expand Down
4 changes: 2 additions & 2 deletions doc/users/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ consider: the location being annotated represented by the argument
``xy`` and the location of the text ``xytext``. Both of these
arguments are ``(x,y)`` tuples.

.. plot:: pyplots/annotation_basic.py
.. plot:: mpl_examples/pyplots/annotation_basic.py
:include-source:


Expand Down Expand Up @@ -80,7 +80,7 @@ keyword args like ``horizontalalignment``, ``verticalalignment`` and
``fontsize`` are passed from `~matplotlib.Axes.annotate` to the
``Text`` instance.

.. plot:: pyplots/annotation_polar.py
.. plot:: mpl_examples/pyplots/annotation_polar.py
:include-source:

For more on all the wild and wonderful things you can do with
Expand Down
8 changes: 4 additions & 4 deletions doc/users/artists.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ drawing of the ticks, tick labels and axis labels.
Try creating the figure below.

.. plot:: pyplots/fig_axes_labels_simple.py
.. plot:: mpl_examples/pyplots/fig_axes_labels_simple.py

.. _customizing-artists:

Expand Down Expand Up @@ -323,7 +323,7 @@ obtain by setting the ``Artist`` transform to :attr:`fig.transFigure

In [195]: fig.canvas.draw()

.. plot:: pyplots/fig_x.py
.. plot:: mpl_examples/pyplots/fig_x.py


Here is a summary of the Artists the figure contains
Expand Down Expand Up @@ -598,7 +598,7 @@ grid Turn the grid on or off for the major or minor ticks
Here is an example, not recommended for its beauty, which customizes
the axes and tick properties

.. plot:: pyplots/fig_axes_customize_simple.py
.. plot:: mpl_examples/pyplots/fig_axes_customize_simple.py
:include-source:


Expand Down Expand Up @@ -635,5 +635,5 @@ label2On boolean which determines whether to draw tick label
Here is an example which sets the formatter for the right side ticks with
dollar signs and colors them green on the right side of the yaxis

.. plot:: pyplots/dollar_ticks.py
.. plot:: mpl_examples/pyplots/dollar_ticks.py
:include-source:
2 changes: 1 addition & 1 deletion doc/users/mathtext.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,5 +340,5 @@ Example

Here is an example illustrating many of these features in context.

.. plot:: pyplots/pyplot_mathtext.py
.. plot:: mpl_examples/pyplots/pyplot_mathtext.py
:include-source:
2 changes: 1 addition & 1 deletion doc/users/path_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ All that remains is to create the path, attach it to a

Here is the result

.. plot:: pyplots/compound_path_demo.py
.. plot:: mpl_examples/pyplots/compound_path_demo.py
6 changes: 3 additions & 3 deletions doc/users/prev_whats_new/whats_new_0.98.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ multiple columns and rows, as well as fancy box drawing. See
:func:`~matplotlib.pyplot.legend` and
:class:`matplotlib.legend.Legend`.

.. plot:: pyplots/whats_new_98_4_legend.py
.. plot:: mpl_examples/pyplots/whats_new_98_4_legend.py

.. _fancy-annotations:

Expand All @@ -44,7 +44,7 @@ boxes and connectors in annotations. See
:class:`~matplotlib.patches.ArrowStyle`, and
:class:`~matplotlib.patches.ConnectionStyle`.

.. plot:: pyplots/whats_new_98_4_fancy.py
.. plot:: mpl_examples/pyplots/whats_new_98_4_fancy.py

.. _psd-amplitude:

Expand Down Expand Up @@ -84,7 +84,7 @@ can pass an *x* array and a *ylower* and *yupper* array to fill
between, and an optional *where* argument which is a logical mask
where you want to do the filling.

.. plot:: pyplots/whats_new_98_4_fill_between.py
.. plot:: mpl_examples/pyplots/whats_new_98_4_fill_between.py

Lots more
-----------
Expand Down
6 changes: 3 additions & 3 deletions doc/users/prev_whats_new/whats_new_0.99.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ toolkit mpl_toolkits.mplot3d (which now comes standard with all mpl
installs). See :ref:`mplot3d-examples-index` and
:ref:`toolkit_mplot3d-tutorial`

.. plot:: pyplots/whats_new_99_mplot3d.py
.. plot:: mpl_examples/pyplots/whats_new_99_mplot3d.py

.. _whats-new-axes-grid:

Expand All @@ -43,7 +43,7 @@ new mpl installs. See :ref:`axes_grid1-examples-index`,
:ref:`axisartist-examples-index`, :ref:`axes_grid1_users-guide-index` and
:ref:`axisartist_users-guide-index`

.. plot:: pyplots/whats_new_99_axes_grid.py
.. plot:: mpl_examples/pyplots/whats_new_99_axes_grid.py

.. _whats-new-spine:

Expand All @@ -58,4 +58,4 @@ well as "detach" the spine to offset it away from the data. See
:ref:`pylab_examples-spine_placement_demo` and
:class:`matplotlib.spines.Spine`.

.. plot:: pyplots/whats_new_99_spines.py
.. plot:: mpl_examples/pyplots/whats_new_99_spines.py
2 changes: 1 addition & 1 deletion doc/users/prev_whats_new/whats_new_1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ supporting mixing of 2D and 3D graphs in the same figure, and/or
multiple 3D graphs in a single figure, using the "projection" keyword
argument to add_axes or add_subplot. Thanks Ben Root.

.. plot:: pyplots/whats_new_1_subplot3d.py
.. plot:: mpl_examples/pyplots/whats_new_1_subplot3d.py

tick_params
------------
Expand Down
14 changes: 7 additions & 7 deletions doc/users/pyplot_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ and in most places in the documentation refers to the *axes*
`part of a figure <http://matplotlib.org/faq/usage_faq.html#parts-of-a-figure>`__
and not the strict mathematical term for more than one axis).

.. plot:: pyplots/pyplot_simple.py
.. plot:: mpl_examples/pyplots/pyplot_simple.py
:include-source:

You may be wondering why the x-axis ranges from 0-3 and the y-axis
Expand All @@ -41,7 +41,7 @@ MATLAB, and you concatenate a color string with a line style string.
The default format string is 'b-', which is a solid blue line. For
example, to plot the above with red circles, you would issue

.. plot:: pyplots/pyplot_formatstr.py
.. plot:: mpl_examples/pyplots/pyplot_formatstr.py
:include-source:

See the :func:`~matplotlib.pyplot.plot` documentation for a complete
Expand All @@ -57,7 +57,7 @@ converted to numpy arrays internally. The example below illustrates a
plotting several lines with different format styles in one command
using arrays.

.. plot:: pyplots/pyplot_three.py
.. plot:: mpl_examples/pyplots/pyplot_three.py
:include-source:

.. _controlling-line-properties:
Expand Down Expand Up @@ -164,7 +164,7 @@ current axes (a :class:`matplotlib.axes.Axes` instance), and
to worry about this, because it is all taken care of behind the
scenes. Below is a script to create two subplots.

.. plot:: pyplots/pyplot_two_subplots.py
.. plot:: mpl_examples/pyplots/pyplot_two_subplots.py
:include-source:

The :func:`~matplotlib.pyplot.figure` command here is optional because
Expand Down Expand Up @@ -231,7 +231,7 @@ an arbitrary location, and the :func:`~matplotlib.pyplot.xlabel`,
are used to add text in the indicated locations (see :ref:`text-intro`
for a more detailed example)

.. plot:: pyplots/pyplot_text.py
.. plot:: mpl_examples/pyplots/pyplot_text.py
:include-source:


Expand Down Expand Up @@ -277,7 +277,7 @@ two points to consider: the location being annotated represented by
the argument ``xy`` and the location of the text ``xytext``. Both of
these arguments are ``(x,y)`` tuples.

.. plot:: pyplots/pyplot_annotate.py
.. plot:: mpl_examples/pyplots/pyplot_annotate.py
:include-source:

In this basic example, both the ``xy`` (arrow tip) and ``xytext``
Expand All @@ -300,7 +300,7 @@ of magnitude. Changing the scale of an axis is easy:
An example of four plots with the same data and different scales for the y axis
is shown below.

.. plot:: pyplots/pyplot_scales.py
.. plot:: mpl_examples/pyplots/pyplot_scales.py
:include-source:

It is also possible to add your own scale, see :ref:`adding-new-scales` for
Expand Down
2 changes: 1 addition & 1 deletion doc/users/screenshots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Although matplotlib's internal math rendering engine is quite
powerful, sometimes you need TeX. Matplotlib supports external TeX
rendering of strings with the *usetex* option.

.. plot:: pyplots/tex_demo.py
.. plot:: mpl_examples/pyplots/tex_demo.py

.. _screenshots_eeg_demo:

Expand Down
2 changes: 1 addition & 1 deletion doc/users/text_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ All of these functions create and return a
variety of font and other properties. The example below shows all of
these commands in action.

.. plot:: pyplots/text_commands.py
.. plot:: mpl_examples/pyplots/text_commands.py
:include-source:
2 changes: 1 addition & 1 deletion doc/users/text_props.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ code indicates that the coordinates are given relative to the axes
bounding box, with 0,0 being the lower left of the axes and 1,1 the
upper right.

.. plot:: pyplots/text_layout.py
.. plot:: mpl_examples/pyplots/text_layout.py
:include-source:


Expand Down
2 changes: 1 addition & 1 deletion doc/users/transforms_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ dpi setting. Likewise, in the figure below, the display labeled
points are probably not the same as in the ipython session because the
documentation figure size defaults are different.

.. plot:: pyplots/annotate_transform.py
.. plot:: mpl_examples/pyplots/annotate_transform.py


.. note::
Expand Down
2 changes: 1 addition & 1 deletion doc/users/usetex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ matplotlibrc use::

Here is the standard example, `tex_demo.py`:

.. plot:: pyplots/tex_demo.py
.. plot:: mpl_examples/pyplots/tex_demo.py
:include-source:

Note that display math mode (``$$ e=mc^2 $$``) is not supported, but adding the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)

# Fixing random state for reproducibility
np.random.seed(19680801)

ax1 = fig.add_subplot(221)
ax1.plot(2000*np.random.rand(10))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(0)
# Fixing random state for reproducibility
np.random.seed(19680801)

# fake up some data
spread = np.random.rand(50) * 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
fig = plt.figure()
ax = fig.add_subplot(111)

# Fixing random state for reproducibility
np.random.seed(19680801)

# histogram our data with numpy
data = np.random.randn(1000)
n, bins = np.histogram(data, 100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

# Fixing random state for reproducibility
np.random.seed(19680801)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(100*np.random.rand(20))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
s = np.sin(2*np.pi*t)
line, = ax1.plot(t, s, color='blue', lw=2)

# Fixing random state for reproducibility
np.random.seed(19680801)

ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3])
n, bins, patches = ax2.hist(np.random.randn(1000), 50,
facecolor='yellow', edgecolor='yellow')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

from matplotlib.ticker import NullFormatter # useful for `logit` scale

# Fixing random state for reproducibility
np.random.seed(19680801)

# make up some data in the interval ]0, 1[
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
y = y[(y > 0) & (y < 1)]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.random.seed(19680801)

mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 26 additions & 1 deletion lib/matplotlib/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,32 @@ def test_pep8_conformance_examples():
'*/pylab_examples/tricontour_demo.py',
'*/pylab_examples/tripcolor_demo.py',
'*/pylab_examples/triplot_demo.py',
'*/shapes_and_collections/artist_reference.py']
'*/shapes_and_collections/artist_reference.py',
'*/pyplots/align_ylabels.py',
'*/pyplots/annotate_transform.py',
'*/pyplots/pyplot_simple.py',
'*/pyplots/annotation_basic.py',
'*/pyplots/annotation_polar.py',
'*/pyplots/auto_subplots_adjust.py',
'*/pyplots/pyplot_two_subplots.py',
'*/pyplots/boxplot_demo.py',
'*/pyplots/tex_demo.py',
'*/pyplots/compound_path_demo.py',
'*/pyplots/text_commands.py',
'*/pyplots/dollar_ticks.py',
'*/pyplots/text_layout.py',
'*/pyplots/fig_axes_customize_simple.py',
'*/pyplots/whats_new_1_subplot3d.py',
'*/pyplots/fig_axes_labels_simple.py',
'*/pyplots/whats_new_98_4_fancy.py',
'*/pyplots/fig_x.py',
'*/pyplots/whats_new_98_4_fill_between.py',
'*/pyplots/whats_new_98_4_legend.py',
'*/pyplots/pyplot_annotate.py',
'*/pyplots/whats_new_99_axes_grid.py',
'*/pyplots/pyplot_formatstr.py',
'*/pyplots/pyplot_mathtext.py',
'*/pyplots/whats_new_99_spines.py']
assert_pep8_conformance(dirname=exdir,
extra_exclude_directories=blacklist,
pep8_additional_ignore=PEP8_ADDITIONAL_IGNORE +
Expand Down

0 comments on commit 6709b59

Please sign in to comment.