
我正在畫一條拋物線。 LaTeX 程式碼運作良好。但是,當我想在程式碼中加點時
\filldraw (A) circle (1pt) node[above right] {A};
然後圖表就消失了。代碼是
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\a{1}
\def\c{1}
\def\xo{1}
\def\xA{-7}
\def\xB{2}
\def\xC{7.5}
\draw[domain=-2:4,smooth,variable=\x,blue] plot ({\x},{\a*(\x-\xo)*(\x-\xo) + \c});
\pgfmathsetmacro{\yA}{\a*(\xA-\xo)*(\xA-\xo)+\c};
\coordinate (A) at (\xA,\yA);
\filldraw (A) circle (1pt) node[above right] {A};
\draw[->] (-2,0) -- (8,0) node[right] {$x$};
\draw[->] (0,-1) -- (0,4) node[above] {$y$};
\end{tikzpicture}
\end{document}
謝謝。
答案1
您嘗試添加一個(-7/65)
距離圖表幾英里遠的點,從而使整個圖像太大以至於無法在頁面上顯示。
如果使用圖中的一個點,您的程式碼可以正常運作:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\a{1}
\def\c{1}
\def\xo{1}
\def\xA{0}
\def\xB{2}
\def\xC{7.5}
\draw[domain=-2:4,smooth,variable=\x,blue] plot ({\x},{\a*(\x-\xo)*(\x-\xo) + \c});
\pgfmathsetmacro{\yA}{\a*(\xA-\xo)*(\xA-\xo)+\c};
\coordinate (A) at (\xA,\yA);
\filldraw (A) circle (1pt) node[above right] {A};
\draw[->] (-2,0) -- (8,0) node[right] {$x$};
\draw[->] (0,-1) -- (0,4) node[above] {$y$};
\end{tikzpicture}
\end{document}