8000 Apply suggestions from code review · matplotlib/matplotlib@feda832 · GitHub
[go: up one dir, main page]

Skip to content

Commit feda832

Browse files
jklymaktacaswell
andcommitted
Apply suggestions from code review
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
1 parent 35c6b5d commit feda832

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

doc/api/next_api_changes/behavior/28061-JMK.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ imshow *interpolation_stage* default changed to 'antialiased'
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33

44
The *interpolation_stage* keyword argument `~.Axes.imshow` has a new default
5-
value 'antialiased'. For images that are down-sampled or up-sampled less than
6-
a factor of three, image interpolation will occur in 'rgba' space. For images
5+
value 'antialiased'. For images that are up-sampled less than a factor of
6+
three or down-sampled , image interpolation will occur in 'rgba' space. For images
77
that are up-sampled by more than a factor of 3, then image interpolation occurs
88
in 'data' space.
99

galleries/examples/images_contours_and_fields/image_antialiasing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
array, it is rare that the size of the data array exactly matches the number of
99
pixels allotted to the image in the figure, so Matplotlib resamples or `scales
1010
<https://en.wikipedia.org/wiki/Image_scaling>`_ the data or image to fit. If
11-
the data array is larger than the number of pixels allotted in the image file,
11+
the data array is larger than the number of pixels allotted in the rendered figure,
1212
then the image will be "down-sampled" and image information will be lost.
13-
Conversely, if the data array is smaller than the number of pixels then each
13+
Conversely, if the data array is smaller than the number of output pixels then each
1414
data point will get multiple pixels, and the image is "up-sampled".
1515
1616
In the following figure, the first data array has size (450, 450), but is
@@ -126,7 +126,7 @@
126126
# white regions to the image that are not in the original data, both in the
127127
# alternating bands on the left hand side of the image, and in the boundary
128128
# between the red and blue of the large circles in the middle of the image.
129-
# The interpolation at the 'rgba' stage is more natural, with the alternating
129+
# The interpolation at the 'rgba' stage has a different artifact, with the alternating
130130
# bands coming out a shade of purple; even though purple is not in the original
131131
# colormap, it is what we perceive when a blue and red stripe are close to each
132132
# other.
@@ -165,7 +165,8 @@
165165

166166
# %%
167167
# A final example shows the desirability of performing the anti-aliasing at
168-
# the RGBA stage. In the following, the data in the upper 100 rows is exactly
168+
# the RGBA stage when using non-trivial interpolation kernels. In the following,
169+
# the data in the upper 100 rows is exactly
169170
# 0.0, and data in the inner circle is exactly 2.0. If we perform the
170171
# *interpolation_stage* in 'data' space and use an anti-aliasing filter (first
171172
# panel), then floating point imprecision makes some of the data values just a

0 commit comments

Comments
 (0)
0