| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9c7e0de commit bda0d3d
38 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,13 @@ | |||
| 3 | 3 | Affine transform of an image | |
| 4 | 4 | ============================ | |
| 5 | 5 | ||
| 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 | + | ||
| 6 | 13 | For the backends that support draw_image with optional affine | |
| 7 | 14 | transform (e.g., agg, ps backend), the image of the output should | |
| 8 | 15 | have its boundary match the dashed yellow rectangle. | |
@@ -57,3 +64,19 @@ def do_plot(ax, Z, transform): | |||
| 57 | 64 | rotate_deg(30).skew_deg(30, 15).scale(-1, .5).translate(.5, -1)) | |
| 58 | 65 | ||
| 59 | 66 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,3 +51,18 @@ | |||
| 51 | 51 | ax2.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle') | |
| 52 | 52 | ||
| 53 | 53 | 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 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ | |||
| 3 | 3 | Barcode Demo | |
| 4 | 4 | ============ | |
| 5 | 5 | ||
| 6 | + This demo shows how to produce a one-dimensional image, or "bar code". | ||
| 6 | 7 | """ | |
| 7 | 8 | import matplotlib.pyplot as plt | |
| 8 | 9 | import numpy as np | |
@@ -19,7 +20,7 @@ | |||
| 19 | 20 | ||
| 20 | 21 | fig = plt.figure() | |
| 21 | 22 | ||
| 22 | - # a vertical barcode -- this is broken at present | ||
| 23 | + # a vertical barcode | ||
| 23 | 24 | ax1 = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) | |
| 24 | 25 | ax1.imshow(x.reshape((-1, 1)), **barprops) | |
| 25 | 26 | ||
@@ -29,3 +30,17 @@ | |||
| 29 | 30 | ||
| 30 | 31 | ||
| 31 | 32 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,8 +3,8 @@ | |||
| 3 | 3 | Contour Corner Mask | |
| 4 | 4 | =================== | |
| 5 | 5 | ||
| 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. | ||
| 8 | 8 | """ | |
| 9 | 9 | import matplotlib.pyplot as plt | |
| 10 | 10 | import numpy as np | |
@@ -36,3 +36,19 @@ | |||
| 36 | 36 | ax.plot(np.ma.array(x, mask=~mask), y, 'ro') | |
| 37 | 37 | ||
| 38 | 38 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,15 +6,15 @@ | |||
| 6 | 6 | Illustrate simple contour plotting, contours on an image with | |
| 7 | 7 | a colorbar for the contours, and labelled contours. | |
| 8 | 8 | ||
| 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>`. | ||
| 10 | 12 | """ | |
| 11 | 13 | import matplotlib | |
| 12 | 14 | import numpy as np | |
| 13 | 15 | import matplotlib.cm as cm | |
| 14 | 16 | import matplotlib.pyplot as plt | |
| 15 | 17 | ||
| 16 | - matplotlib.rcParams['xtick.direction'] = 'out' | ||
| 17 | - matplotlib.rcParams['ytick.direction'] = 'out' | ||
| 18 | 18 | ||
| 19 | 19 | delta = 0.025 | |
| 20 | 20 | x = np.arange(-3.0, 3.0, delta) | |
@@ -116,3 +116,23 @@ | |||
| 116 | 116 | CB.ax.set_position([ll, b + 0.1*h, ww, h*0.8]) | |
| 117 | 117 | ||
| 118 | 118 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,11 +4,15 @@ | |||
| 4 | 4 | ============= | |
| 5 | 5 | ||
| 6 | 6 | 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>`. | ||
| 8 | 10 | ||
| 9 | 11 | The emphasis in this demo is on showing how to make contours register | |
| 10 | 12 | 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>` | ||
| 12 | 16 | keyword arguments to imshow and contour. | |
| 13 | 17 | """ | |
| 14 | 18 | import matplotlib.pyplot as plt | |
@@ -91,3 +95,23 @@ | |||
| 91 | 95 | ||
| 92 | 96 | fig.tight_layout() | |
| 93 | 97 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,8 @@ | |||
| 6 | 6 | Illustrate some of the more advanced things that one can do with | |
| 7 | 7 | contour labels. | |
| 8 | 8 | ||
| 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>`. | ||
| 10 | 11 | """ | |
| 11 | 12 | ||
| 12 | 13 | import matplotlib | |
@@ -15,9 +16,6 @@ | |||
| 15 | 16 | import matplotlib.ticker as ticker | |
| 16 | 17 | import matplotlib.pyplot as plt | |
| 17 | 18 | ||
| 18 | - matplotlib.rcParams['xtick.direction'] = 'out' | ||
| 19 | - matplotlib.rcParams['ytick.direction'] = 'out' | ||
| 20 | - | ||
| 21 | 19 | ############################################################################### | |
| 22 | 20 | # Define our surface | |
| 23 | 21 | ||
@@ -89,3 +87,20 @@ def __repr__(self): | |||
| 89 | 87 | ax2.set_title("$100^Z$") | |
| 90 | 88 | ||
| 91 | 89 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | Contourf Demo | |
| 4 | 4 | ============= | |
| 5 | 5 | ||
| 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. | ||
| 7 | 7 | """ | |
| 8 | 8 | import numpy as np | |
| 9 | 9 | import matplotlib.pyplot as plt | |
@@ -105,3 +105,27 @@ | |||
| 105 | 105 | ax.locator_params(nbins=4) | |
| 106 | 106 | ||
| 107 | 107 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,3 +39,25 @@ | |||
| 39 | 39 | artists, labels = cs.legend_elements() | |
| 40 | 40 | ax2.legend(artists, labels, handleheight=2) | |
| 41 | 41 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,3 +47,22 @@ | |||
| 47 | 47 | cbar = fig.colorbar(cs) | |
| 48 | 48 | ||
| 49 | 49 | 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 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments