Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Hi,
Hopefully, my issue is not too unimportant and this is the right place to ask about it.
I experienced a minor problem, when using theplt.savefig
function to save my plots to either.png
(and also for.jpg
) with a high resolution (300 dpi). If I specified to not use the standard font but set a font family to serif (plt.rcParams["font.family"] = "serif"
) all x-axis labels containing the digit "1", that I tried, namely0.1
and1.0
are misaligned in y-direction by 1 pixel. It's not noticeable most of the time, but when one has two subplots next to each other and the1.0
label of one plot and the0.0
label of the other are really next to each other, the labels look off.
As a minimal working example you can run:
import matplotlibimport matplotlib.pyplot as pltplt.rcParams["font.family"] = "serif"fig, ax = plt.subplots(1, 1)plt.savefig("minimalExample.png", dpi=300)
and then zoom in onto0.8
and1.0
. You can see the difference best, when you compare the decimal points.
Here is also a picture of the zoom and one of the two subplots, where I saw the problem first:
I tried this on a Linux machine withpython
version2.7.9
andmatplotlib
versions1.4.2
installed fromdebian
repositories and1.5.1
installed viapip
.
Generally, this is not a big problem, though, as one can use alternate formats likepdf
oreps
if one really cares about a one pixel misalignment. Nonetheless, I thought, I might let you know. Feel free to close/delete this issue, if you consider it as too unimportant (or if this is the wrong place to raise it, as it might just be an external libraries fault).
Best (and thanks for this great package),
Jonathan