diff --git a/doc/users/prev_whats_new/whats_new_1.5.rst b/doc/users/prev_whats_new/whats_new_1.5.rst
index ec31bd887e0a..19610709498f 100644
--- a/doc/users/prev_whats_new/whats_new_1.5.rst
+++ b/doc/users/prev_whats_new/whats_new_1.5.rst
@@ -109,8 +109,8 @@ You can even multiply cyclers, which is like using `itertools.product()`
on two or more property cycles. Remember to use parentheses if writing
a multi-line `prop_cycle` parameter.
-.. figure:: ../../gallery/color/images/sphx_glr_color_cycle_001.png
- :target: ../../gallery/color/color_cycle.html
+.. figure:: ../../tutorials/intermediate/images/sphx_glr_color_cycle_001.png
+ :target: ../../tutorials/intermediate/color_cycle.html
:align: center
:scale: 50
diff --git a/examples/animation/histogram.py b/examples/animation/histogram.py
index 75adca125da5..365157172ab2 100644
--- a/examples/animation/histogram.py
+++ b/examples/animation/histogram.py
@@ -3,8 +3,7 @@
Animated histogram
==================
-This example shows how to use a path patch to draw a bunch of
-rectangles for an animated histogram.
+Use a path patch to draw a bunch of rectangles for an animated histogram.
"""
import numpy as np
@@ -14,8 +13,6 @@
import matplotlib.path as path
import matplotlib.animation as animation
-fig, ax = plt.subplots()
-
# Fixing random state for reproducibility
np.random.seed(19680801)
@@ -30,13 +27,23 @@
top = bottom + n
nrects = len(left)
-# here comes the tricky part -- we have to set up the vertex and path
-# codes arrays using moveto, lineto and closepoly
-
-# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
-# CLOSEPOLY; the vert for the closepoly is ignored but we still need
-# it to keep the codes aligned with the vertices
-nverts = nrects*(1 + 3 + 1)
+###############################################################################
+# Here comes the tricky part -- we have to set up the vertex and path codes
+# arrays using ``plt.Path.MOVETO``, ``plt.Path.LINETO`` and
+# ``plt.Path.CLOSEPOLY`` for each rect.
+#
+# * We need 1 ``MOVETO`` per rectangle, which sets the initial point.
+# * We need 3 ``LINETO``'s, which tell Matplotlib to draw lines from
+# vertex 1 to vertex 2, v2 to v3, and v3 to v4.
+# * We then need one ``CLOSEPOLY`` which tells Matplotlib to draw a line from
+# the v4 to our initial vertex (the ``MOVETO`` vertex), in order to close the
+# polygon.
+#
+# .. note::
+#
+# The vertex for ``CLOSEPOLY`` is ignored, but we still need a placeholder
+# in the ``verts`` array to keep the codes aligned with the vertices.
+nverts = nrects * (1 + 3 + 1)
verts = np.zeros((nverts, 2))
codes = np.ones(nverts, int) * path.Path.LINETO
codes[0::5] = path.Path.MOVETO
@@ -50,13 +57,12 @@
verts[3::5, 0] = right
verts[3::5, 1] = bottom
-barpath = path.Path(verts, codes)
-patch = patches.PathPatch(
- barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
-ax.add_patch(patch)
-
-ax.set_xlim(left[0], right[-1])
-ax.set_ylim(bottom.min(), top.max())
+###############################################################################
+# To animate the histogram, we need an ``animate`` function, which generates
+# a random set of numbers and updates the locations of the vertices for the
+# histogram (in this case, only the heights of each rectangle). ``patch`` will
+# eventually be a ``Patch`` object.
+patch = None
def animate(i):
@@ -68,5 +74,18 @@ def animate(i):
verts[2::5, 1] = top
return [patch, ]
+###############################################################################
+# And now we build the `Path` and `Patch` instances for the histogram using
+# our vertices and codes. We add the patch to the `Axes` instance, and setup
+# the `FuncAnimation` with our animate function.
+fig, ax = plt.subplots()
+barpath = path.Path(verts, codes)
+patch = patches.PathPatch(
+ barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
+ax.add_patch(patch)
+
+ax.set_xlim(left[0], right[-1])
+ax.set_ylim(bottom.min(), top.max())
+
ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True)
plt.show()
diff --git a/tutorials/intermediate/color_cycle.py b/tutorials/intermediate/color_cycle.py
new file mode 100644
index 000000000000..ba463ade6bf9
--- /dev/null
+++ b/tutorials/intermediate/color_cycle.py
@@ -0,0 +1,125 @@
+"""
+===================
+Styling with cycler
+===================
+
+Demo of custom property-cycle settings to control colors and other style
+properties for multi-line plots.
+
+.. note::
+
+ More complete documentation of the ``cycler`` API can be found
+ `here
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: