Skip to content

Tick labels containing the digit "1" slightly misaligned in some plot exports #6847

Closed as not planned
@jotasi

Description

@jotasi

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 the plt.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, namely 0.1 and 1.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 the 1.0 label of one plot and the 0.0 label of the other are really next to each other, the labels look off.

As a minimal working example you can run:

import matplotlib
import matplotlib.pyplot as plt

plt.rcParams["font.family"] = "serif"

fig, ax = plt.subplots(1, 1)
plt.savefig("minimalExample.png", dpi=300)

and then zoom in onto 0.8 and 1.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:

minimalexamplezoom

minimalexampletwoplots

I tried this on a Linux machine with python version 2.7.9 and matplotlib versions 1.4.2 installed from debian repositories and 1.5.1 installed via pip.
Generally, this is not a big problem, though, as one can use alternate formats like pdf or eps 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: text

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions