【发布时间】:2020-09-11 11:36:07
【问题描述】:
我创建了一个 python matplotlib 图与
import matplotlib.pyplot as plt
xwidth = 418.25555 / 72 # conversion from in to pt
ywidth = 300 / 72 # conversion from in to pt
fig,ax = plt.subplots(figsize=[xwidth, ywidth])
ax.plot([1,2,3],[1,2,3])
ax.set_ylabel("Y-label")
ax.set_xlabel("X-label")
fig.savefig("test.pgf", bbox_inches="tight", pad=0)
我在 XeLaTeX 中通过\the\textwidth 确定了xwidth,并且必须将其转换为英寸。一英寸定义为 72 磅。但是,如果我将图形包含到我的文档中,它与线宽不匹配:
\documentclass{scrartcl}
\usepackage{pgf}
\begin{document}
\begin{figure}
\input{test.pgf}
\end{figure}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam\newline
Linewidth: \the\textwidth
\end{document}
我做错了什么?
【问题讨论】:
-
在 TeX 中,一个 pt 是 1/72.27 英寸。但是,在这种情况下,它只占大约半毫米,所以肯定还有其他东西。
标签: python matplotlib latex xelatex pgf