diff --git a/examples/color/color_by_yvalue.py b/examples/color/color_by_yvalue.py index 26ffbd95091d..4c9e61a8326f 100644 --- a/examples/color/color_by_yvalue.py +++ b/examples/color/color_by_yvalue.py @@ -22,3 +22,17 @@ fig, ax = plt.subplots() ax.plot(t, smiddle, t, slower, t, supper) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.plot +matplotlib.pyplot.plot diff --git a/examples/color/color_cycle_default.py b/examples/color/color_cycle_default.py index ae887b15c2ab..d4f70a0d90df 100644 --- a/examples/color/color_cycle_default.py +++ b/examples/color/color_cycle_default.py @@ -3,7 +3,8 @@ Colors in the default property cycle ==================================== -Display the colors from the default prop_cycle. +Display the colors from the default prop_cycle, which is obtained from the +:ref:`rc parameters`. """ import numpy as np import matplotlib.pyplot as plt @@ -38,3 +39,21 @@ fig.suptitle('Colors in the default prop_cycle', fontsize='large') plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.axhline +matplotlib.axes.Axes.axvline +matplotlib.pyplot.axhline +matplotlib.pyplot.axvline +matplotlib.axes.Axes.set_facecolor +matplotlib.figure.Figure.suptitle diff --git a/examples/color/color_cycler.py b/examples/color/color_cycler.py index b1f64c794b95..bab0cb163559 100644 --- a/examples/color/color_cycler.py +++ b/examples/color/color_cycler.py @@ -8,8 +8,10 @@ This example demonstrates two different APIs: - 1. Setting the default rc parameter specifying the property cycle. - This affects all subsequent axes (but not axes already created). + 1. Setting the default + :ref:`rc parameter` + specifying the property cycle. This affects all subsequent axes + (but not axes already created). 2. Setting the property cycle for a single pair of axes. """ from cycler import cycler @@ -43,3 +45,17 @@ # Tweak spacing between subplots to prevent labels from overlapping fig.subplots_adjust(hspace=0.3) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.plot +matplotlib.axes.Axes.set_prop_cycle diff --git a/examples/color/color_demo.py b/examples/color/color_demo.py index 684e4a8ddd8c..9740744f3cfe 100644 --- a/examples/color/color_demo.py +++ b/examples/color/color_demo.py @@ -3,32 +3,75 @@ Color Demo ========== -matplotlib gives you 5 ways to specify colors, +Matplotlib gives you 8 ways to specify colors, - 1) as a single letter string, ala MATLAB +1) an RGB or RGBA tuple of float values in ``[0, 1]`` (e.g. ``(0.1, 0.2, 0.5)`` + or ``(0.1, 0.2, 0.5, 0.3)``). RGBA is short for Red, Green, Blue, Alpha; +2) a hex RGB or RGBA string (e.g., ``'#0F0F0F'`` or ``'#0F0F0F0F'``); +3) a string representation of a float value in ``[0, 1]`` inclusive for gray + level (e.g., ``'0.5'``); +4) a single letter string, i.e. one of + ``{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}``; +5) a X11/CSS4 ("html") color name, e.g. ``"blue"``; +6) a name from the `xkcd color survey `__, + prefixed with ``'xkcd:'`` (e.g., ``'xkcd:sky blue'``); +7) a "Cn" color spec, i.e. `'C'` followed by a single digit, which is an index + into the default property cycle + (``matplotlib.rcParams['axes.prop_cycle']``); the indexing occurs at artist + creation time and defaults to black if the cycle does not include color. +8) one of ``{'tab:blue', 'tab:orange', 'tab:green', + 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', + 'tab:gray', 'tab:olive', 'tab:cyan'}`` which are the Tableau Colors from the + 'tab10' categorical palette (which is the default color cycle); - 2) as an html style hex string or html color name +For more information on colors in matplotlib see - 3) as an R,G,B tuple, where R,G,B, range from 0-1 - - 4) as a string representing a floating point number - from 0 to 1, corresponding to shades of gray. - - 5) as a special color "Cn", where n is a number 0-9 specifying the - nth color in the currently active color cycle. - -See help(colors) for more info. +* the :ref:`sphx_glr_tutorials_colors_colors.py` tutorial; +* the `matplotlib.colors` API; +* the :ref:`sphx_glr_gallery_color_named_colors.py` example. """ + import matplotlib.pyplot as plt import numpy as np -t = np.arange(0.0, 2.0, 0.01) +t = np.linspace(0.0, 2.0, 201) s = np.sin(2 * np.pi * t) -fig, ax = plt.subplots(facecolor='darkslategray') -ax.plot(t, s, 'C1') -ax.set_xlabel('time (s)', color='C1') -ax.set_ylabel('voltage (mV)', color='0.5') # grayscale color -ax.set_title('About as silly as it gets, folks', color='#afeeee') +# 1) RGB tuple: +fig, ax = plt.subplots(facecolor=(.18, .31, .31)) +# 2) hex string: +ax.set_facecolor('#eafff5') +# 3) gray level string: +ax.set_title('Voltage vs. time chart', color='0.7') +# 4) single letter color string +ax.set_xlabel('time (s)', color='c') +# 5) a named color: +ax.set_ylabel('voltage (mV)', color='peachpuff') +# 6) a named xkcd color: +ax.plot(t, s, 'xkcd:crimson') +# 7) Cn notation: +ax.plot(t, .7*s, color='C4', linestyle='--') +# 8) tab notation: +ax.tick_params(labelcolor='tab:orange') + plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.colors +matplotlib.axes.Axes.plot +matplotlib.axes.Axes.set_facecolor +matplotlib.axes.Axes.set_title +matplotlib.axes.Axes.set_xlabel +matplotlib.axes.Axes.set_ylabel +matplotlib.axes.Axes.tick_params diff --git a/examples/color/colorbar_basics.py b/examples/color/colorbar_basics.py index a3c4b8e1e420..6ba4d00477b6 100644 --- a/examples/color/colorbar_basics.py +++ b/examples/color/colorbar_basics.py @@ -3,8 +3,9 @@ Colorbar ======== -Use colorbar by specifying the mappable object (here -the imshow returned object) and the axes to attach the colorbar to. +Use `~.figure.Figure.colorbar` by specifying the mappable object (here +the `~.matplotlib.image.AxesImage` returned by `~.axes.Axes.imshow`) +and the axes to attach the colorbar to. """ import numpy as np @@ -35,3 +36,19 @@ fig.colorbar(neg, ax=ax2) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.imshow +matplotlib.pyplot.imshow +matplotlib.figure.Figure.colorbar +matplotlib.pyplot.colorbar diff --git a/examples/color/colormap_reference.py b/examples/color/colormap_reference.py index 5927a727c09d..8e4d3d14f7ee 100644 --- a/examples/color/colormap_reference.py +++ b/examples/color/colormap_reference.py @@ -65,3 +65,19 @@ def plot_color_gradients(cmap_category, cmap_list, nrows): plot_color_gradients(cmap_category, cmap_list, nrows) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.colors +matplotlib.axes.Axes.imshow +matplotlib.figure.Figure.text +matplotlib.axes.Axes.set_axis_off diff --git a/examples/color/named_colors.py b/examples/color/named_colors.py index 7bae6bd9ed59..ea9b08c61318 100644 --- a/examples/color/named_colors.py +++ b/examples/color/named_colors.py @@ -4,6 +4,12 @@ ======================== Simple plot example with the named colors and its visual representation. + +For more information on colors in matplotlib see + +* the :ref:`sphx_glr_tutorials_colors_colors.py` tutorial; +* the `matplotlib.colors` API; +* the :ref:`sphx_glr_gallery_color_color_demo.py`. """ import matplotlib.pyplot as plt @@ -52,3 +58,22 @@ top=1, bottom=0, hspace=0, wspace=0) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.colors +matplotlib.colors.rgb_to_hsv +matplotlib.colors.to_rgba +matplotlib.figure.Figure.get_size_inches +matplotlib.figure.Figure.subplots_adjust +matplotlib.axes.Axes.text +matplotlib.axes.Axes.hlines diff --git a/examples/pie_and_polar_charts/nested_pie.py b/examples/pie_and_polar_charts/nested_pie.py index d1a3855b9601..ce2be648f1cb 100644 --- a/examples/pie_and_polar_charts/nested_pie.py +++ b/examples/pie_and_polar_charts/nested_pie.py @@ -76,3 +76,22 @@ ax.set(title="Pie plot with `ax.bar` and polar coordinates") ax.set_axis_off() plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.pie +matplotlib.pyplot.pie +matplotlib.axes.Axes.bar +matplotlib.pyplot.bar +matplotlib.projections.polar +matplotlib.axes.Axes.set +matplotlib.axes.Axes.set_axis_off diff --git a/examples/pie_and_polar_charts/pie_and_donut_labels.py b/examples/pie_and_polar_charts/pie_and_donut_labels.py index 7e6e606e8cb2..49e75606cd2c 100644 --- a/examples/pie_and_polar_charts/pie_and_donut_labels.py +++ b/examples/pie_and_polar_charts/pie_and_donut_labels.py @@ -123,3 +123,20 @@ def func(pct, allvals): # And here it is, the donut. Note however, that if we were to use this recipe, # the ingredients would suffice for around 6 donuts - producing one huge # donut is untested and might result in kitchen errors. + + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.pie +matplotlib.pyplot.pie +matplotlib.axes.Axes.legend +matplotlib.pyplot.legend diff --git a/examples/pie_and_polar_charts/pie_demo2.py b/examples/pie_and_polar_charts/pie_demo2.py index 6487e20b3d6d..fc173eda78e3 100644 --- a/examples/pie_and_polar_charts/pie_demo2.py +++ b/examples/pie_and_polar_charts/pie_demo2.py @@ -3,7 +3,7 @@ Pie Demo2 ========= -Make a pie charts using :meth:`.Axes.pie`. +Make a pie charts using :meth:`~.axes.Axes.pie`. This example demonstrates some pie chart features like labels, varying size, autolabeling the percentage, offsetting a slice and adding a shadow. @@ -44,3 +44,17 @@ autotexts[0].set_color('white') plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.pie +matplotlib.pyplot.pie diff --git a/examples/pie_and_polar_charts/pie_features.py b/examples/pie_and_polar_charts/pie_features.py index 65b85b02320a..d52f3a699aee 100644 --- a/examples/pie_and_polar_charts/pie_features.py +++ b/examples/pie_and_polar_charts/pie_features.py @@ -33,3 +33,17 @@ ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.pie +matplotlib.pyplot.pie diff --git a/examples/pie_and_polar_charts/polar_bar.py b/examples/pie_and_polar_charts/polar_bar.py index 38a557ab4553..58fd07fad682 100644 --- a/examples/pie_and_polar_charts/polar_bar.py +++ b/examples/pie_and_polar_charts/polar_bar.py @@ -27,3 +27,18 @@ bar.set_alpha(0.5) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.bar +matplotlib.pyplot.bar +matplotlib.projections.polar diff --git a/examples/pie_and_polar_charts/polar_demo.py b/examples/pie_and_polar_charts/polar_demo.py index eb89d19c92cb..1ba897a9fa48 100644 --- a/examples/pie_and_polar_charts/polar_demo.py +++ b/examples/pie_and_polar_charts/polar_demo.py @@ -21,3 +21,21 @@ ax.set_title("A line plot on a polar axis", va='bottom') plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.plot +matplotlib.projections.polar +matplotlib.projections.polar.PolarAxes +matplotlib.projections.polar.PolarAxes.set_rticks +matplotlib.projections.polar.PolarAxes.set_rmax +matplotlib.projections.polar.PolarAxes.set_rlabel_position diff --git a/examples/pie_and_polar_charts/polar_legend.py b/examples/pie_and_polar_charts/polar_legend.py index 4fe6b201090f..f7f58a9be17d 100644 --- a/examples/pie_and_polar_charts/polar_legend.py +++ b/examples/pie_and_polar_charts/polar_legend.py @@ -26,3 +26,19 @@ ax.legend() plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.plot +matplotlib.axes.Axes.legend +matplotlib.projections.polar +matplotlib.projections.polar.PolarAxes diff --git a/examples/pie_and_polar_charts/polar_scatter.py b/examples/pie_and_polar_charts/polar_scatter.py index f3ce26b7eb9e..350369ed3557 100644 --- a/examples/pie_and_polar_charts/polar_scatter.py +++ b/examples/pie_and_polar_charts/polar_scatter.py @@ -54,3 +54,22 @@ ax.set_thetamax(135) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.axes.Axes.scatter +matplotlib.pyplot.scatter +matplotlib.projections.polar +matplotlib.projections.polar.PolarAxes.set_rorigin +matplotlib.projections.polar.PolarAxes.set_theta_zero_location +matplotlib.projections.polar.PolarAxes.set_thetamin +matplotlib.projections.polar.PolarAxes.set_thetamax diff --git a/examples/shapes_and_collections/artist_reference.py b/examples/shapes_and_collections/artist_reference.py index 42e0c50ed7d3..d3fb7c01cec0 100644 --- a/examples/shapes_and_collections/artist_reference.py +++ b/examples/shapes_and_collections/artist_reference.py @@ -5,7 +5,7 @@ This example displays several of matplotlib's graphics primitives (artists) drawn using matplotlib API. A full list of artists and the documentation is -available at http://matplotlib.org/api/artist_api.html. +available at :ref:`the artist API `. Copyright (c) 2010, Bartosz Telenczuk BSD License @@ -18,9 +18,6 @@ from matplotlib.collections import PatchCollection -plt.rcdefaults() - - def label(xy, text): y = xy[1] - 0.15 # shift y-value for label so that it's below the artist plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14) @@ -104,3 +101,33 @@ def label(xy, text): plt.tight_layout() plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.path +matplotlib.path.Path +matplotlib.lines +matplotlib.lines.Line2D +matplotlib.patches +matplotlib.patches.Circle +matplotlib.patches.Ellipse +matplotlib.patches.Wedge +matplotlib.patches.Rectangle +matplotlib.patches.Arrow +matplotlib.patches.PathPatch +matplotlib.patches.FancyBboxPatch +matplotlib.patches.RegularPolygon +matplotlib.collections +matplotlib.collections.PatchCollection +matplotlib.cm.ScalarMappable.set_array +matplotlib.axes.Axes.add_collection +matplotlib.axes.Axes.add_line diff --git a/examples/shapes_and_collections/collections.py b/examples/shapes_and_collections/collections.py index b12b6f853c7a..853d95ff35f3 100644 --- a/examples/shapes_and_collections/collections.py +++ b/examples/shapes_and_collections/collections.py @@ -6,7 +6,8 @@ For the first two subplots, we will use spirals. Their size will be set in plot units, not data units. Their positions will be set in data units by using the "offsets" and "transOffset" -kwargs of the LineCollection and PolyCollection. +kwargs of the `~.collections.LineCollection` and +`~.collections.PolyCollection`. The third subplot will make regular polygons, with the same type of scaling and positioning as in the first two. @@ -125,3 +126,23 @@ plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.figure.Figure +matplotlib.collections +matplotlib.collections.LineCollection +matplotlib.collections.RegularPolyCollection +matplotlib.axes.Axes.add_collection +matplotlib.axes.Axes.autoscale_view +matplotlib.transforms.Affine2D +matplotlib.transforms.Affine2D.scale diff --git a/examples/shapes_and_collections/compound_path.py b/examples/shapes_and_collections/compound_path.py index 25dc23da6ad6..5667f494001d 100644 --- a/examples/shapes_and_collections/compound_path.py +++ b/examples/shapes_and_collections/compound_path.py @@ -4,7 +4,7 @@ ============= Make a compound path -- in this case two simple polygons, a rectangle -and a triangle. Use CLOSEPOLY and MOVETO for the different parts of +and a triangle. Use ``CLOSEPOLY`` and ``MOVETO`` for the different parts of the compound path """ import numpy as np @@ -31,8 +31,24 @@ ax.add_patch(pathpatch) ax.set_title('A compound path') -ax.dataLim.update_from_data_xy(vertices) ax.autoscale_view() - plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.path +matplotlib.path.Path +matplotlib.patches +matplotlib.patches.PathPatch +matplotlib.axes.Axes.add_patch +matplotlib.axes.Axes.autoscale_view diff --git a/examples/shapes_and_collections/dolphin.py b/examples/shapes_and_collections/dolphin.py index d50b5f61726c..90d48469f426 100644 --- a/examples/shapes_and_collections/dolphin.py +++ b/examples/shapes_and_collections/dolphin.py @@ -4,8 +4,8 @@ ======== This example shows how to draw, and manipulate shapes given vertices -and nodes using the `Patches`, `Path` and `Transforms` classes. - +and nodes using the `~.path.Path`, `~.patches.PathPatch` and +`~matplotlib.transforms` classes. """ import matplotlib.cm as cm @@ -101,3 +101,24 @@ ax.add_patch(dolphin_patch2) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.path +matplotlib.path.Path +matplotlib.patches +matplotlib.patches.PathPatch +matplotlib.patches.Circle +matplotlib.axes.Axes.add_patch +matplotlib.transforms +matplotlib.transforms.Affine2D +matplotlib.transforms.Affine2D.rotate_deg diff --git a/examples/shapes_and_collections/donut.py b/examples/shapes_and_collections/donut.py index fca5ff6a91fb..794cd342b039 100644 --- a/examples/shapes_and_collections/donut.py +++ b/examples/shapes_and_collections/donut.py @@ -3,7 +3,8 @@ Mmh Donuts!!! ============= -Draw donuts (miam!) using Path and Patches. +Draw donuts (miam!) using `~.path.Path`\s and `~.patches.PathPatch`\es. +This example shows the effect of the path's orientations in a compound path. """ import numpy as np @@ -60,3 +61,26 @@ def make_circle(r): ax.set_title('Mmm, donuts!') ax.set_aspect(1.0) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.path +matplotlib.path.Path +matplotlib.patches +matplotlib.patches.PathPatch +matplotlib.patches.Circle +matplotlib.axes.Axes.add_patch +matplotlib.axes.Axes.annotate +matplotlib.axes.Axes.set_aspect +matplotlib.axes.Axes.set_xlim +matplotlib.axes.Axes.set_ylim +matplotlib.axes.Axes.set_title diff --git a/examples/shapes_and_collections/ellipse_collection.py b/examples/shapes_and_collections/ellipse_collection.py index 952c988aaf48..9b7a71f55643 100644 --- a/examples/shapes_and_collections/ellipse_collection.py +++ b/examples/shapes_and_collections/ellipse_collection.py @@ -3,6 +3,9 @@ Ellipse Collection ================== +Drawing a collection of ellipses. While this would equally be possible using +a `~.collections.EllipseCollection` or `~.collections.PathCollection`, the use +of an `~.collections.EllipseCollection` allows for much shorter code. """ import matplotlib.pyplot as plt import numpy as np @@ -31,3 +34,20 @@ cbar = plt.colorbar(ec) cbar.set_label('X+Y') plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.collections +matplotlib.collections.EllipseCollection +matplotlib.axes.Axes.add_collection +matplotlib.axes.Axes.autoscale_view +matplotlib.cm.ScalarMappable.set_array diff --git a/examples/shapes_and_collections/ellipse_demo.py b/examples/shapes_and_collections/ellipse_demo.py index 3fd33d9afdf0..21fbe7d9c0e5 100644 --- a/examples/shapes_and_collections/ellipse_demo.py +++ b/examples/shapes_and_collections/ellipse_demo.py @@ -3,6 +3,9 @@ Ellipse Demo ============ +Draw many ellipses. Here individual ellipses are drawn. Compare this +to the :ref:`Ellipse collection example +`. """ import matplotlib.pyplot as plt import numpy as np @@ -26,3 +29,50 @@ ax.set_ylim(0, 10) plt.show() + +############################################################################# +# =============== +# Ellipse Rotated +# =============== +# +# Draw many ellipses with different angles. +# + +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.patches import Ellipse + +delta = 45.0 # degrees + +angles = np.arange(0, 360 + delta, delta) +ells = [Ellipse((1, 1), 4, 2, a) for a in angles] + +a = plt.subplot(111, aspect='equal') + +for e in ells: + e.set_clip_box(a.bbox) + e.set_alpha(0.1) + a.add_artist(e) + +plt.xlim(-2, 4) +plt.ylim(-1, 3) + +plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.patches +matplotlib.patches.Ellipse +matplotlib.axes.Axes.add_artist +matplotlib.artist.Artist.set_clip_box +matplotlib.artist.Artist.set_alpha +matplotlib.patches.Patch.set_facecolor diff --git a/examples/shapes_and_collections/ellipse_rotated.py b/examples/shapes_and_collections/ellipse_rotated.py deleted file mode 100644 index 3bf7e8f57c86..000000000000 --- a/examples/shapes_and_collections/ellipse_rotated.py +++ /dev/null @@ -1,26 +0,0 @@ -""" -=============== -Ellipse Rotated -=============== - -""" -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.patches import Ellipse - -delta = 45.0 # degrees - -angles = np.arange(0, 360 + delta, delta) -ells = [Ellipse((1, 1), 4, 2, a) for a in angles] - -a = plt.subplot(111, aspect='equal') - -for e in ells: - e.set_clip_box(a.bbox) - e.set_alpha(0.1) - a.add_artist(e) - -plt.xlim(-2, 4) -plt.ylim(-1, 3) - -plt.show() diff --git a/examples/shapes_and_collections/fancybox_demo.py b/examples/shapes_and_collections/fancybox_demo.py index e1dc1eb451e0..60415ef8db58 100644 --- a/examples/shapes_and_collections/fancybox_demo.py +++ b/examples/shapes_and_collections/fancybox_demo.py @@ -194,3 +194,20 @@ def test_all(): test_all() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.patches +matplotlib.patches.FancyBboxPatch +matplotlib.patches.BoxStyle +matplotlib.patches.BoxStyle.get_styles +matplotlib.transforms.Bbox diff --git a/examples/shapes_and_collections/hatch_demo.py b/examples/shapes_and_collections/hatch_demo.py index 4379d13839a7..66ea648f60d7 100644 --- a/examples/shapes_and_collections/hatch_demo.py +++ b/examples/shapes_and_collections/hatch_demo.py @@ -33,3 +33,22 @@ ax3.set_ylim((0, 2.5)) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.patches +matplotlib.patches.Ellipse +matplotlib.patches.Polygon +matplotlib.axes.Axes.add_patch +matplotlib.patches.Patch.set_hatch +matplotlib.axes.Axes.bar +matplotlib.pyplot.bar diff --git a/examples/shapes_and_collections/line_collection.py b/examples/shapes_and_collections/line_collection.py index f9a06eb7d33c..343c4a124ac5 100644 --- a/examples/shapes_and_collections/line_collection.py +++ b/examples/shapes_and_collections/line_collection.py @@ -5,7 +5,7 @@ Plotting lines with Matplotlib. -:class:`matplotlib.collections.LineCollection` allows one to plot multiple +:class:`~matplotlib.collections.LineCollection` allows one to plot multiple lines on a figure. Below we show off some of its properties. """ import matplotlib.pyplot as plt @@ -82,3 +82,22 @@ ax.set_title('Line Collection with mapped colors') plt.sci(line_segments) # This allows interactive changing of the colormap. plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.collections +matplotlib.collections.LineCollection +matplotlib.cm.ScalarMappable.set_array +matplotlib.axes.Axes.add_collection +matplotlib.figure.Figure.colorbar +matplotlib.pyplot.colorbar +matplotlib.pyplot.sci diff --git a/examples/shapes_and_collections/marker_path.py b/examples/shapes_and_collections/marker_path.py index 12eec947b3a5..7d43df365b32 100644 --- a/examples/shapes_and_collections/marker_path.py +++ b/examples/shapes_and_collections/marker_path.py @@ -3,6 +3,7 @@ Marker Path =========== +Using a `~.path.Path` as marker for a `~.axes.Axes.plot`. """ import matplotlib.pyplot as plt import matplotlib.path as mpath @@ -20,3 +21,21 @@ plt.plot(np.arange(10)**2, '--r', marker=cut_star, markersize=15) plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.path +matplotlib.path.Path +matplotlib.path.Path.unit_regular_star +matplotlib.path.Path.unit_circle +matplotlib.axes.Axes.plot +matplotlib.pyplot.plot diff --git a/examples/shapes_and_collections/path_patch.py b/examples/shapes_and_collections/path_patch.py index dc07c2a5b004..16b1dceea70e 100644 --- a/examples/shapes_and_collections/path_patch.py +++ b/examples/shapes_and_collections/path_patch.py @@ -3,7 +3,7 @@ PathPatch object ================ -This example shows how to create `Path`\s and `PathPatch` objects through +This example shows how to create `~.path.Path` and `~.patches.PathPatch` objects through Matplotlib's API. """ import matplotlib.path as mpath @@ -37,3 +37,20 @@ ax.grid() ax.axis('equal') plt.show() + +############################################################################# +# +# ------------ +# +# References +# """""""""" +# +# The use of the following functions, methods, classes and modules is shown +# in this example: + +import matplotlib +matplotlib.path +matplotlib.path.Path +matplotlib.patches +matplotlib.patches.PathPatch +matplotlib.axes.Axes.add_patch