-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Vertical alignment of tick labels with usetex=True #6323
Comments
attn: @mdboom. I am a bit disconcerted that the 2 and 4 (positive and On Thu, Apr 21, 2016 at 6:48 AM, KeithWM notifications@github.com wrote:
|
TeX is returning bogus descender values for the negative sign. Haven't quite figured out why yet. |
A temporary workaround is to use LaTeX's
This causes LaTeX to affect a vertical shift in the positive labels as well (this is therefore not a fix but a workaround). The trailing |
I looked a bit into this and as it turns out it is intentionally that the minus sign has a nonzero descent: https://tex.stackexchange.com/questions/526103/why-does-cmsy10-tfm-give-the-minus-sign-a-positive-depth/ (thanks tex.stackexchange). Essentially, the tfm metrics are used (especially) to alignment of math formulae, rather than to determine rasterization bboxes, which is what we need here. There are a few solutions here:
The advantage of the first two solutions is that (I think) this would allow us to get rid of the Tfm and possibly Vf classes, as we would be able to rely on freetype to get glyph metrics. |
If I set
the vertical alignment of tick labels is incorrect. For negative ticks, the tick labels are quite visibly lower than the positive marks. See the screenshot for an example.
A minimal working example:
from matplotlib import pyplot as plt
plt.close('all')
# import seaborn as sns
# sns.set_context("poster", font_scale=2)
The screenshot uses seaborn, as using its font properties exaggerates the error, but it is also visible without seaborn on close inspection.
In constructing this MWE, I discovered that the problem goes away if I reverse the order of the two plots, or if I set
plt.rc('text', usetex=False)
beforeplt.show()
.I installed python 2.7.11 and matplotlib 1.5.1 via anaconda. I'm using the Qt4Agg backend, interactively.
The text was updated successfully, but these errors were encountered: