|
84 | 84 | # the pixel center will have the same color as it does with nearest, but
|
85 | 85 | # other pixels will be interpolated between the neighboring pixels.
|
86 | 86 | #
|
87 |
| -# Earlier versions of matplotlib (<0.63) tried to hide the edge effects |
88 |
| -# from you by setting the view limits so that they would not be visible. |
89 |
| -# A recent bugfix in antigrain, and a new implementation in the |
90 |
| -# matplotlib._image module which takes advantage of this fix, no longer |
91 |
| -# makes this necessary. To prevent edge effects, when doing |
92 |
| -# interpolation, the matplotlib._image module now pads the input array |
93 |
| -# with identical pixels around the edge. e.g., if you have a 5x5 array |
94 |
| -# with colors a-y as below:: |
| 87 | +# To prevent edge effects when doing interpolation, Matplotlib pads the input |
| 88 | +# array with identical pixels around the edge: if you have a 5x5 array with |
| 89 | +# colors a-y as below:: |
95 | 90 | #
|
96 | 91 | # a b c d e
|
97 | 92 | # f g h i j
|
98 | 93 | # k l m n o
|
99 | 94 | # p q r s t
|
100 | 95 | # u v w x y
|
101 | 96 | #
|
102 |
| -# the _image module creates the padded array,:: |
| 97 | +# Matplotlib computes the interpolation and resizing on the padded array :: |
103 | 98 | #
|
104 | 99 | # a a b c d e e
|
105 | 100 | # a a b c d e e
|
|
109 | 104 | # o u v w x y y
|
110 | 105 | # o u v w x y y
|
111 | 106 | #
|
112 |
| -# does the interpolation/resizing, and then extracts the central region. |
113 |
| -# This allows you to plot the full range of your array w/o edge effects, |
114 |
| -# and for example to layer multiple images of different sizes over one |
115 |
| -# another with different interpolation methods - see |
116 |
| -# :doc:`/gallery/images_contours_and_fields/layer_images`. |
117 |
| -# It also implies a performance hit, as this |
118 |
| -# new temporary, padded array must be created. Sophisticated |
119 |
| -# interpolation also implies a performance hit, so if you need maximal |
120 |
| -# performance or have very large images, interpolation='nearest' is |
121 |
| -# suggested. |
| 107 | +# and then extracts the central region of the result. (Extremely old versions |
| 108 | +# of Matplotlib (<0.63) did not pad the array, but instead adjusted the view |
| 109 | +# limits to hide the affected edge areas.) |
| 110 | +# |
| 111 | +# This approach allows plotting the full extent of an array without |
| 112 | +# edge effects, and for example to layer multiple images of different |
| 113 | +# sizes over one another with different interpolation methods -- see |
| 114 | +# :doc:`/gallery/images_contours_and_fields/layer_images`. It also implies |
| 115 | +# a performance hit, as this new temporary, padded array must be created. |
| 116 | +# Sophisticated interpolation also implies a performance hit; for maximal |
| 117 | +# performance or very large images, interpolation='nearest' is suggested. |
122 | 118 |
|
123 | 119 | A = np.random.rand(5, 5)
|
124 | 120 |
|
|
0 commit comments