@@ -27,37 +27,35 @@ Image Artists
27
27
BboxImage
28
28
29
29
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:
47
45
48
46
1. resample the user input to the required dimensions
49
47
2. normalize the user data via a `~.colors.Normalize ` instance
50
48
3. colormap from the normalized data to RGBA via a `~.colors.Colormap ` instance
51
49
52
50
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 thescale of a few screen pixels. Because most
56
- colormaps are notstraight lines inRGB space theinterpolated values
57
- "cut thecorner" 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 resampledin RGBA space to fit the screen. However,
52
+ colormaps are not straight lines in RGB space the RGBA interpolated
53
+ values may "cut thecorner" and produce colors in the output image
54
+ that are notpresent inthe colormap when thedata is changing close
55
+ to thefull range on the scale of a few screen pixels. To fix this
56
+ problem we re-ordered the processing in 2.0.
57
+
58
+
61
59
62
60
63
61
What you need to know about Floating Point Arithmetic for Colormapping