matplotlib / cheatsheets

Official Matplotlib cheat sheets

Home Page:https://matplotlib.org/cheatsheets/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cheatsheets-2.png shows interpolation different for none vs None

zingale opened this issue · comments

If you look at the imagine cheatsheets-2.png linked in the README.md:
https://github.com/matplotlib/cheatsheets/blob/master/cheatsheets-2.png

in the interpolations image grid, the "none" version actually is using some sort of interpolation. This makes it seem like "none" and None are different, but they should not be.

When I run the interpolations.py script locally
(https://github.com/matplotlib/cheatsheets/blob/master/scripts/interpolations.py) I get the following:

interpolations.pdf

which has the correct top row.

The image in the repo should be updated.

I think the difference is between PDF viewers and how they interpolate. For instance, your PDF on Preview looks like the png:

interps

I'm not sure what to do in this case - 'none' means just do whatever your renderer does. Its generally a bad idea to use 'none'.
None will do "Hanning" if the image is downsampled or upsampled less than 2 times, or Nearest if not (as of 3.2: matplotlib/matplotlib#13724).

Indeed, I think it would be useful if this cheatsheet used the new default "antialiased" at some point, though this is a grossly over-sampled image so the anti-aliasing doesn't kick in.

Relatedly, I think it showing None and none is confusing... The first is the special value, but the second is a string.

I would be annoying to remove the none (just because with it, I can have a 3x6 grids). But I agree it might be confusing. We can put it first without label but using the "None" interpolation to suggest these are the real values.

Maybe put quotes on the strings?

Yes, we can add quotes. But still, the "none" does not seem to be really consistent across viewers. Is it worth to mention it?

I am 👍 on dropping 'none' (which is the same as 'nearest' in Agg, but leaves you at the mercy of your display program on the vector out puts) is reasonable. There are other interpolations that we can pull from to still have a 3x3 grid.

either mentioning that "none" is not consistent or removing it would be good.

Might have been closed by #80. @timhoffm, please consider.