Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Doc update antialiasing#18749
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Doc update antialiasing#18749
Uh oh!
There was an error while loading.Please reload this page.
Conversation
9341f9b
toc66256c
CompareI think that this needs a warning box that says "This may introduce colors to you images that are not in the color map, use this only if you are interested in qualitative images.". Probably also worth pointing out I am not sure that this is the best justification for needing to do RGBA space interpolation though, you can get the same "clean up" of the edge of the disk by using importmatplotlib.colorsasmcolorsfig,axs=plt.subplots(1,2,figsize=(3.5,2),sharex=True,sharey=True,constrained_layout=True)aa=np.ones_like(a)aa[np.sqrt(R)<0.5]=-1norm=mcolors.Normalize(vmin=-1,vmax=1)axs[0].imshow(aa,cmap='RdBu_r')axs[0].set_title('Data antialiasing')pc=axs[1].imshow(aa,interpolation='nearest',cmap='RdBu_r')axs[1].set_title('Data Nearest')plt.show() I think this example should stay, but as a cautionary comment of "in some cases the hanning kernel may do things you wish it did not to big very sharp structures, in that case force back to 'nearest'". If user data has both large infinitly sharp featuresand small fast oscillating features (other than that sounding like it involves some cool physics) is just a Hard Visualization Problem and they need more (screen (or detector)) pixels. Personally I find the red-on-blue very hard to look at because my glasses have terrible chromatic aberration and if I turn my head the circle shifts a fair amount so it is very unclear to me what of what I am seeing is real in the image and what is a very local problem to my eyes (I see a pruple cresecent on one side and a white cerscent on the other!). |
I see this too, but I don't think it's real. If you copy the image to GIMP, rotate it 180 degrees, the purple crescent remains on the left, and white on the right. Whether it's due to RGBA pixel layouts or what, I'm not sure. |
b3632a5
tob1492f9
CompareThis should still really go in the anti-aliasing discussion, even if#18782 goes in eventually. |
timhoffm left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Feel free to reword further. The proposed changes are not set in stone.
@@ -72,6 +74,73 @@ | |||
ax.set_title(f"interpolation='{interp}'") | |||
plt.show() | |||
############################################################################### | |||
# Data antialiasing and RGBA antialiasing |
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'd name this "Antialiasing colormapped data" and add a same-level "Antialiasing grayscale images".
And make some subsubsections here for "Data antialiasing" and "RGBA antialiasing".
// Well technically, grayscale is also a colormapping. The real difference is whether the colormapping is a straight line in RGB space or not. But I wouldn't go into the details here. Almost all colorful maps have quite some curve in RGB space.
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'm not quite sure what you mean here? The first section was all about data antialiasing, with black and white chosen to make it obvious what was going one. This section is pointing out that this antialiasing is not the same as visual anti-aliasing.
constrained_layout=True) | ||
for ax, interp in zip(axs, ['nearest', 'antialiased']): | ||
pc = ax.imshow(a, interpolation=interp, cmap='RdBu_r', vmin=-1, vmax=1) | ||
ax.set_title(f"'{interp}'", fontsize='small') |
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.
ax.set_title(f"'{interp}'",fontsize='small') | |
ax.set_title(f"'{interp}'") |
I would not reduce the title size:
- The titles are important for distinction if you only look at the image.
- Consistency: All titles above use the original title size.
a_rgba = cmap(norm(a)) | ||
for ax, interp in zip(axs, ['nearest', 'antialiased']): | ||
pc = ax.imshow(a_rgba, interpolation=interp) | ||
ax.set_title(f"'{interp}'", fontsize='small') |
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.
ax.set_title(f"'{interp}'",fontsize='small') | |
ax.set_title(f"'{interp}'") |
a_rgba = cmap(norm(aa)) | ||
axs[0].imshow(aa, interpolation='nearest', cmap='RdBu_r') | ||
axs[0].set_title('No antialiasing') |
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.
Interestingly, the titles are clipped at the top:
https://52747-1385122-gh.circle-artifacts.com/0/doc/build/html/gallery/images_contours_and_fields/image_antialiasing.html#sphx-glr-gallery-images-contours-and-fields-image-antialiasing-py
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.
Yeah, CL sometimes has burbles like that if it is shrinking to fit rather than growing to fit. I just made the figure a bit bigger
# is given here, where the anti-aliasing returns white pixels in data space, | ||
# and (imperceptible) purple pixels in RGBA space: |
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.
# is given here, where the anti-aliasing returns white pixels in data space, | |
# and (imperceptible) purple pixels in RGBA space: | |
# is given here: All data points are either -1 or +1, corresponding to blue and red. The smoothing in data space can create any value between -1 and +1, and thus result in values that never occur in the original data (e.g. 0-valued pixels in white). Alternatively, when smoothing in RGBA space, we can get purple pixels as a mixture of blue and red. The disadvantage here is that these colors are not even in the colormap, and thus strictly have no meaning. However, visually they have a more intuitive "mixture of blue and red" appearance. |
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.
OK, modified this based on this suggestion....
f2d017b
to3fa9867
Compare3fa9867
to44bfb9b
CompareIhope we will change this for 3.5, so this will probably be obsolete |
This is now obsolete |
PR Summary
Partially addresses#18735 by discussing colormapping in the context of anti-aliasing images...
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
andpydocstyle<4
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).