Skip to content

Commit 0478be2

Browse files
committed
DOC/WIP: reorganization
1 parent 0010012 commit 0478be2

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

doc/api/image_api.rst

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,35 @@ Image Artists
2727
BboxImage
2828

2929

30-
Resampling
31-
~~~~~~~~~~
32-
33-
When Matplotlib rasterizes an image to save / display a Figure,
34-
we need to, in general, resample the data (either up or down) in
35-
addition to normalizing and color mapping it. This is because the
36-
exact size of the input, in "data" pixels, will not match the size, in
37-
"screen" pixels, of the output. The details of how we do the
38-
resampling is controlled by the *interpolation* specified. This
39-
resampling process can introduce a variety of artifacts and the
40-
default interpolation is chosen to avoid aliasing in common cases (see
41-
:doc:`/gallery/images_contours_and_fields/image_antialiasing`).
42-
43-
Colormapping
44-
~~~~~~~~~~~~
45-
46-
The processing steps for rendering a pseudo color image are:
30+
Resampling and Colormapping
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
33+
When Matplotlib rasterizes an image to save / display a Figure, we
34+
need to resample the user supplied data because the size of the input,
35+
in "data" pixels, will in general not match the size, in "screen"
36+
pixels, of the output. This resampling process can introduce a
37+
variety of artifacts and the default interpolation is chosen to avoid
38+
aliasing in common cases (see
39+
:doc:`/gallery/images_contours_and_fields/image_antialiasing`). The
40+
details of how we do the resampling is controlled by the
41+
*interpolation* kwarg and, depending on the kernel, may also
42+
implicitly smooth the user data.
43+
44+
The processing steps for rendering a pseudo color image are currently:
4745

4846
1. resample the user input to the required dimensions
4947
2. normalize the user data via a `~.colors.Normalize` instance
5048
3. colormap from the normalized data to RGBA via a `~.colors.Colormap` instance
5149

5250
Prior to Matplotlib 2.0 we did the normalization and colormapping
53-
first and then resampled to fit the screen. However this can produce
54-
artifacts in the visualization when the data is changing close to the
55-
full range on the scale of a few screen pixels. Because most
56-
colormaps are not straight lines in RGB space the interpolated values
57-
"cut the corner" and produce colors in the output image that are not
58-
present in the colormap. To fix this problem we re-ordered the
59-
processing, however this has lead to a number of subtle issues with
60-
floating point discussed below.
51+
first and then resampled in RGBA space to fit the screen. However,
52+
colormaps are not straight lines in RGB space the RGBA interpolated
53+
values may "cut the corner" and produce colors in the output image
54+
that are not present in the colormap when the data is changing close
55+
to the full range on the scale of a few screen pixels. To fix this
56+
problem we re-ordered the processing in 2.0.
57+
58+
6159

6260

6361
What you need to know about Floating Point Arithmetic for Colormapping

0 commit comments

Comments
 (0)