
我認為這是一個簡單的任務......但我幾乎要放棄,因為我無法畫出簡單的兩點之間的箭頭。只有當我刪除 \pgfplotsset{compat=newest} 時,我的 MWE 才有效和 \畫。 pdf輸出是不穩定的,事實上,當有東西出現時,箭頭就處於錯誤的位置。 Stack... 中找到的類似範例均無效。我懷疑我錯過了一些基本的東西非常感謝您的幫助。
我的MWE
\documentclass[border=4pt]{standalone}
%
\usepackage{pgfplots}
%
\pgfplotsset{compat=newest} % added without success
%
\begin{document}
%
\begin{tikzpicture}[scale=1.0]
%
\begin{axis}
%
\addplot[domain=0.5:3, red, thin] {(x^2-3)/2};
%
\end{axis}
%
\coordinate (orig) (0,0)
%
\coordinate (R) at (2,1/2)
%
\draw [->,thick,blue] (orig) -- (R)
%
\end{tikzpicture}
%
\end{document}
答案1
歡迎!有兩件事。您缺少三個分號和一個at
.但我想問題是為什麼座標不是你想要的位置。這是因為您在環境中定義它們tikzpicture
,而不是在axis
.解決這個問題會產生
\documentclass[border=4pt]{standalone}
%
\usepackage{pgfplots}
%
\pgfplotsset{compat=newest} % added without success
%
\begin{document}
%
\begin{tikzpicture}[scale=1.0]
%
\begin{axis}
%
\addplot[domain=0.5:3, red, thin] {(x^2-3)/2};
%
\coordinate (orig) at (0,0);
\coordinate (orig') at (0.5,-3/2);
\coordinate (R) at (2,1/2);
\end{axis}
%
\draw [->,thick,blue] (orig') -- (R);
%
\end{tikzpicture}
%
\end{document}