Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ac28fee

Browse filesBrowse files
authored
Merge pull request #11191 from ImportanceOfBeingErnest/example-refs_imgscntrs
DOC: Adding example references for Images,contours,fields section
2 parents efc0729 + bda0d3d commit ac28fee
Copy full SHA for ac28fee
Expand file treeCollapse file tree

38 files changed

+757
-93
lines changed

‎examples/images_contours_and_fields/affine_image.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/affine_image.py
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Affine transform of an image
44
============================
55
6+
7+
Prepending an affine transformation (:class:`~.transforms.Affine2D`)
8+
to the :ref:`data transform <data-coords>`
9+
of an image allows to manipulate the image's shape and orientation.
10+
This is an example of the concept of
11+
:ref:`transform chaining <transformation-pipeline>`.
12+
613
For the backends that support draw_image with optional affine
714
transform (e.g., agg, ps backend), the image of the output should
815
have its boundary match the dashed yellow rectangle.
@@ -57,3 +64,19 @@ def do_plot(ax, Z, transform):
5764
rotate_deg(30).skew_deg(30, 15).scale(-1, .5).translate(.5, -1))
5865

5966
plt.show()
67+
68+
69+
#############################################################################
70+
#
71+
# ------------
72+
#
73+
# References
74+
# """"""""""
75+
#
76+
# The use of the following functions, methods and classes is shown
77+
# in this example:
78+
79+
import matplotlib
80+
matplotlib.axes.Axes.imshow
81+
matplotlib.pyplot.imshow
82+
matplotlib.transforms.Affine2D

‎examples/images_contours_and_fields/barb_demo.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/barb_demo.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,18 @@
5151
ax2.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle')
5252

5353
plt.show()
54+
55+
#############################################################################
56+
#
57+
# ------------
58+
#
59+
# References
60+
# """"""""""
61+
#
62+
# The use of the following functions, methods and classes is shown
63+
# in this example:
64+
65+
import matplotlib
66+
matplotlib.axes.Axes.barbs
67+
matplotlib.pyplot.barbs
68+

‎examples/images_contours_and_fields/barcode_demo.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/barcode_demo.py
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Barcode Demo
44
============
55
6+
This demo shows how to produce a one-dimensional image, or "bar code".
67
"""
78
import matplotlib.pyplot as plt
89
import numpy as np
@@ -19,7 +20,7 @@
1920

2021
fig = plt.figure()
2122

22-
# a vertical barcode -- this is broken at present
23+
# a vertical barcode
2324
ax1 = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops)
2425
ax1.imshow(x.reshape((-1, 1)), **barprops)
2526

@@ -29,3 +30,17 @@
2930

3031

3132
plt.show()
33+
34+
#############################################################################
35+
#
36+
# ------------
37+
#
38+
# References
39+
# """"""""""
40+
#
41+
# The use of the following functions, methods and classes is shown
42+
# in this example:
43+
44+
import matplotlib
45+
matplotlib.axes.Axes.imshow
46+
matplotlib.pyplot.imshow

‎examples/images_contours_and_fields/contour_corner_mask.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contour_corner_mask.py
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Contour Corner Mask
44
===================
55
6-
Illustrate the difference between corner_mask=False and corner_mask=True
7-
for masked contour plots.
6+
Illustrate the difference between ``corner_mask=False`` and
7+
``corner_mask=True`` for masked contour plots.
88
"""
99
import matplotlib.pyplot as plt
1010
import numpy as np
@@ -36,3 +36,19 @@
3636
ax.plot(np.ma.array(x, mask=~mask), y, 'ro')
3737

3838
plt.show()
39+
40+
#############################################################################
41+
#
42+
# ------------
43+
#
44+
# References
45+
# """"""""""
46+
#
47+
# The use of the following functions and methods is shown
48+
# in this example:
49+
50+
import matplotlib
51+
matplotlib.axes.Axes.contour
52+
matplotlib.pyplot.contour
53+
matplotlib.axes.Axes.contourf
54+
matplotlib.pyplot.contourf

‎examples/images_contours_and_fields/contour_demo.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contour_demo.py
+23-3Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
Illustrate simple contour plotting, contours on an image with
77
a colorbar for the contours, and labelled contours.
88
9-
See also contour_image.py.
9+
See also the
10+
:ref:`contour image example
11+
<sphx_glr_gallery_images_contours_and_fields_contour_image.py>`.
1012
"""
1113
import matplotlib
1214
import numpy as np
1315
import matplotlib.cm as cm
1416
import matplotlib.pyplot as plt
1517

16-
matplotlib.rcParams['xtick.direction'] = 'out'
17-
matplotlib.rcParams['ytick.direction'] = 'out'
1818

1919
delta = 0.025
2020
x = np.arange(-3.0, 3.0, delta)
@@ -116,3 +116,23 @@
116116
CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8])
117117

118118
plt.show()
119+
120+
#############################################################################
121+
#
122+
# ------------
123+
#
124+
# References
125+
# """"""""""
126+
#
127+
# The use of the following functions and methods is shown
128+
# in this example:
129+
130+
import matplotlib
131+
matplotlib.axes.Axes.contour
132+
matplotlib.pyplot.contour
133+
matplotlib.figure.Figure.colorbar
134+
matplotlib.pyplot.colorbar
135+
matplotlib.axes.Axes.clabel
136+
matplotlib.pyplot.clabel
137+
matplotlib.axes.Axes.set_position
138+
matplotlib.axes.Axes.get_position

‎examples/images_contours_and_fields/contour_image.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contour_image.py
+26-2Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
=============
55
66
Test combinations of contouring, filled contouring, and image plotting.
7-
For contour labelling, see contour_demo.py.
7+
For contour labelling, see See also the
8+
:ref:`contour demo example
9+
<sphx_glr_gallery_images_contours_and_fields_contour_demo.py>`.
810
911
The emphasis in this demo is on showing how to make contours register
1012
correctly on images, and on how to get both of them oriented as
11-
desired. In particular, note the usage of the "origin" and "extent"
13+
desired. In particular, note the usage of the
14+
:ref:`"origin" and "extent"
15+
<sphx_glr_tutorials_intermediate_imshow_extent.py>`
1216
keyword arguments to imshow and contour.
1317
"""
1418
import matplotlib.pyplot as plt
@@ -91,3 +95,23 @@
9195

9296
fig.tight_layout()
9397
plt.show()
98+
99+
100+
#############################################################################
101+
#
102+
# ------------
103+
#
104+
# References
105+
# """"""""""
106+
#
107+
# The use of the following functions, methods and classes is shown
108+
# in this example:
109+
110+
import matplotlib
111+
matplotlib.axes.Axes.contour
112+
matplotlib.pyplot.contour
113+
matplotlib.axes.Axes.imshow
114+
matplotlib.pyplot.imshow
115+
matplotlib.figure.Figure.colorbar
116+
matplotlib.pyplot.colorbar
117+
matplotlib.colors.Normalize

‎examples/images_contours_and_fields/contour_label_demo.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contour_label_demo.py
+19-4Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
Illustrate some of the more advanced things that one can do with
77
contour labels.
88
9-
See also contour_demo.py.
9+
See also the :ref:`contour demo example
10+
<sphx_glr_gallery_images_contours_and_fields_contour_demo.py>`.
1011
"""
1112

1213
import matplotlib
@@ -15,9 +16,6 @@
1516
import matplotlib.ticker as ticker
1617
import matplotlib.pyplot as plt
1718

18-
matplotlib.rcParams['xtick.direction'] = 'out'
19-
matplotlib.rcParams['ytick.direction'] = 'out'
20-
2119
###############################################################################
2220
# Define our surface
2321

@@ -89,3 +87,20 @@ def __repr__(self):
8987
ax2.set_title("$100^Z$")
9088

9189
plt.show()
90+
91+
#############################################################################
92+
#
93+
# ------------
94+
#
95+
# References
96+
# """"""""""
97+
#
98+
# The use of the following functions, methods and classes is shown
99+
# in this example:
100+
101+
matplotlib.axes.Axes.contour
102+
matplotlib.pyplot.contour
103+
matplotlib.axes.Axes.clabel
104+
matplotlib.pyplot.clabel
105+
matplotlib.ticker.LogFormatterMathtext
106+
matplotlib.ticker.TickHelper.create_dummy_axis

‎examples/images_contours_and_fields/contourf_demo.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contourf_demo.py
+25-1Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Contourf Demo
44
=============
55
6-
How to use the ``contourf`` function to create filled contour plots.
6+
How to use the :meth:`.axes.Axes.contourf` method to create filled contour plots.
77
"""
88
import numpy as np
99
import matplotlib.pyplot as plt
@@ -105,3 +105,27 @@
105105
ax.locator_params(nbins=4)
106106

107107
plt.show()
108+
109+
#############################################################################
110+
#
111+
# ------------
112+
#
113+
# References
114+
# """"""""""
115+
#
116+
# The use of the following functions, methods and classes is shown
117+
# in this example:
118+
119+
import matplotlib
120+
matplotlib.axes.Axes.contour
121+
matplotlib.pyplot.contour
122+
matplotlib.axes.Axes.contourf
123+
matplotlib.pyplot.contourf
124+
matplotlib.axes.Axes.clabel
125+
matplotlib.pyplot.clabel
126+
matplotlib.figure.Figure.colorbar
127+
matplotlib.pyplot.colorbar
128+
matplotlib.colors.Colormap
129+
matplotlib.colors.Colormap.set_bad
130+
matplotlib.colors.Colormap.set_under
131+
matplotlib.colors.Colormap.set_over

‎examples/images_contours_and_fields/contourf_hatching.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contourf_hatching.py
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,25 @@
3939
artists, labels = cs.legend_elements()
4040
ax2.legend(artists, labels, handleheight=2)
4141
plt.show()
42+
43+
#############################################################################
44+
#
45+
# ------------
46+
#
47+
# References
48+
# """"""""""
49+
#
50+
# The use of the following functions, methods and classes is shown
51+
# in this example:
52+
53+
import matplotlib
54+
matplotlib.axes.Axes.contour
55+
matplotlib.pyplot.contour
56+
matplotlib.axes.Axes.contourf
57+
matplotlib.pyplot.contourf
58+
matplotlib.figure.Figure.colorbar
59+
matplotlib.pyplot.colorbar
60+
matplotlib.axes.Axes.legend
61+
matplotlib.pyplot.legend
62+
matplotlib.contour.ContourSet
63+
matplotlib.contour.ContourSet.legend_elements

‎examples/images_contours_and_fields/contourf_log.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/contourf_log.py
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,22 @@
4747
cbar = fig.colorbar(cs)
4848

4949
plt.show()
50+
51+
#############################################################################
52+
#
53+
# ------------
54+
#
55+
# References
56+
# """"""""""
57+
#
58+
# The use of the following functions, methods and classes is shown
59+
# in this example:
60+
61+
import matplotlib
62+
matplotlib.axes.Axes.contourf
63+
matplotlib.pyplot.contourf
64+
matplotlib.figure.Figure.colorbar
65+
matplotlib.pyplot.colorbar
66+
matplotlib.axes.Axes.legend
67+
matplotlib.pyplot.legend
68+
matplotlib.ticker.LogLocator

‎examples/images_contours_and_fields/custom_cmap.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/custom_cmap.py
+28-3Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
Creating a colormap from a list of colors
44
=========================================
55
6-
Creating a colormap from a list of colors can be done with the `from_list`
7-
method of `LinearSegmentedColormap`. You must pass a list of RGB tuples that
8-
define the mixture of colors from 0 to 1.
6+
Creating a :ref:`colormap <sphx_glr_tutorials_colors_colormaps.py>`
7+
from a list of colors can be done with the
8+
:meth:`~.colors.LinearSegmentedColormap.from_list` method of
9+
`LinearSegmentedColormap`. You must pass a list of RGB tuples that define the
10+
mixture of colors from 0 to 1.
911
1012
1113
Creating custom colormaps
@@ -223,3 +225,26 @@
223225
fig.subplots_adjust(top=0.9)
224226

225227
plt.show()
228+
229+
#############################################################################
230+
#
231+
# ------------
232+
#
233+
# References
234+
# """"""""""
235+
#
236+
# The use of the following functions, methods, classes and modules is shown
237+
# in this example:
238+
239+
import matplotlib
240+
matplotlib.axes.Axes.imshow
241+
matplotlib.pyplot.imshow
242+
matplotlib.figure.Figure.colorbar
243+
matplotlib.pyplot.colorbar
244+
matplotlib.colors
245+
matplotlib.colors.LinearSegmentedColormap
246+
matplotlib.colors.LinearSegmentedColormap.from_list
247+
matplotlib.cm
248+
matplotlib.cm.ScalarMappable.set_cmap
249+
matplotlib.pyplot.register_cmap
250+
matplotlib.cm.register_cmap

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.