
我使用以下程式碼在 Tikz 中繪製箭頭\pgfplotsset{compat = 1.3}
:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=10,ymin=0,ymax=10,ylabel={Some values},ylabel shift = -10pt]
\draw[->,thick] (3,3) -- (4,4);
\end{axis}
\end{tikzpicture}
\end{document}
但我把箭頭放在了錯誤的位置。我至少需要使用 1.3 版本,因為我需要命令 ylabel shift
來移動標籤pgfplots
(如這個答案)。
有人遇到同樣的問題嗎?
答案1
axis cs:
該問題可以透過添加以下內容來解決\draw[->,thick] (650,66) -- (530,69)
:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=10,ymin=0,ymax=10,ylabel={Some values},ylabel shift = -10pt]
\draw[->,thick] (axis cs:3,3) -- (axis cs:4,4);
\end{axis}
\end{tikzpicture}
\end{document}
正如建議的這則評論。
另一個可能的解決方案是使用更高版本的pgfplots
( \pgfplotsset{compat = 1.16}
):
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=10,ymin=0,ymax=10,ylabel={Some values},ylabel shift = -10pt]
\draw[->,thick] (3,3) -- (4,4);
\end{axis}
\end{tikzpicture}
\end{document}
正如建議的這則評論。