我正在尝试使用外部图形创建一个图。问题是轴范围非常不同,所以我需要使用单位向量 (1,300)。当我尝试编译时,出现以下错误:
! Dimension too large.
<recently read> \pgfmath@x
l.23 \end{axis}
我怎样才能说服 pgfplots 完成这项工作,而无需手动摆弄缩放和 y 刻度标签?
这是我的代码:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis on top,
xlabel={$y$},
ylabel={$x$},
unit vector ratio*=1 300,
width=15cm,
tick align=outside,
x dir=reverse,
]
\addplot graphics [xmin=5,xmax=-5,ymin=33.119,ymax=33.124] {img.png};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
调整height
而不是unit vector ratio
。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis on top,
xlabel={$y$},
ylabel={$x$},
%unit vector ratio*=1 300,
width=15cm,
height=3cm,
tick align=outside,
ytick=\empty, %% y tick doesn't make sense for such a graph
x dir=reverse,
]
\addplot graphics [xmin=5,xmax=-5,ymin=33.119,ymax=33.124] {img.png};
\end{axis}
\end{tikzpicture}
\end{document}