-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed as not planned
Labels
backend: pgfstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.Issues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github ActionMarked by the “Stale” Github Action
Milestone
Description
Hi, it looks like the PGF backend defaults to top-align tick labels without accounting for the height of the letters. This works without problems with the PDF backend, also using Tex to render text does not make a difference.
using this Python code:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(2,2))
ax = fig.add_subplot(111)
ax.plot([1,2],[5,7])
ax.set_xticks([1,2])
ax.set_xticklabels(["up","down"])
ax.set_xlim([0,3]) # get the ticks closer together
plt.tight_layout()
fig.savefig("ticks_std.pdf")
fig.savefig("ticks_std.pgf")
for lab in ax.xaxis.get_ticklabels():
lab.set_verticalalignment("baseline")
fig.savefig("ticks_base.pdf")
fig.savefig("ticks_base.pgf")
for lab in ax.xaxis.get_ticklabels():
lab.set_verticalalignment("top")
fig.savefig("ticks_top.pdf")
fig.savefig("ticks_top.pgf")
... and this Tex document:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tabular}{ccc}
\input{ticks_std.pgf} & \input{ticks_base.pgf} & \input{ticks_top.pgf} \\
\includegraphics{ticks_std.pdf} & \includegraphics{ticks_base.pdf} & \includegraphics{ticks_top.pdf}
\end{tabular}
\end{document}
One possible solution could be to use the baseline alignment with some additional padding depending on the font size.
Metadata
Metadata
Assignees
Labels
backend: pgfstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.Issues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github ActionMarked by the “Stale” Github Action