-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add section on artifacts to imshow docs #16999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ae5866c
to
5ee5a19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some changes, approve even if you discard them.
lib/matplotlib/axes/_axes.py
Outdated
match the number of pixels given in *X*. *interpolation* is used to | ||
calculate the displayed pixels, which is inherently prone to visual | ||
artifacts. Depending on the ratio of given to need pixels different | ||
interpolation methods may be preferable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
"""
The number of pixels used to render an image is set by the axes
size and the *dpi* of the figure, so the image size will usually not
match the size of *X*, which can lead to aliasing artifacts when the
image is resampled
(see :doc:`/gallery/images_contours_and_fields/image_antialiasing`).
The resampling can be controlled via the *interpolation* kwarg
and/or :rc:`image.interpolation`, which defaults to 'antialiased'.
"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my suggedtions crosses @story645 please meld as you see fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yours is mostly clearer, but I'd break it up a little:
"""The number of pixels used to render an image is set by the axes
size and the *dpi* of the figure. This can lead to aliasing artifacts when the
image is resampled because the displayed image size will usually not
match the size of *X*."""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. agreed, that was a run-on sentence.
025ccc3
to
b44d4ca
Compare
lib/matplotlib/axes/_axes.py
Outdated
@@ -5433,7 +5441,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None, | |||
The filter radius for filters that have a radius parameter, i.e. | |||
when interpolation is one of: 'sinc', 'lanczos' or 'blackman'. | |||
|
|||
resample : bool, optional | |||
resample : bool, default: False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for AxesImage
is False; the default for imshow is None
, which means the default here should be the 'image.resample'
rcParam.
Co-authored-by: Jody Klymak <[email protected]> Co-authored-by: hannah <[email protected]>
b44d4ca
to
a32fb6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone can merge on CI green.
Travis OSX failure is unreleated. |
PR Summary
Closes #16976.
And some minor cleanups.