\draw [Bluey!160!,ultra thick, smooth,tension=0.7] plot coordinates {(-3,4)(-2,-3) (0,1)(2,-3)(3,4)};
当我绘制这条曲线而不放箭头时,它看起来像:
放箭之后
\draw [Bluey!160!,ultra thick, smooth,tension=0.7,<->] plot coordinates {(-3,4)(-2,-3) (0,1)(2,-3)(3,4)};
看起来像:
谁能告诉我原因?
这是完整的代码
\begin{scope}[>={Latex[scale=1.2]}, thick]
\draw [dotted,thin] (-6,-6) grid (6,6);
\draw [<->] (-6.5,0)--(6.5,0) node [right] {\Large$$};
\foreach \x in {-5,...,-1,1,2,...,5}{
\draw (\x,-1mm)-- node [below=0.5mm] {$\x$} (\x,1mm);}
\draw [<->] (0,6.5) node [above] {\Large$y$}--(0,-6.5);
\foreach \y in {-5,...,-1,1,2,...,5}{
\draw (1mm,\y)-- node [left=0.5mm] {$\y$} (-1mm,\y);}
\draw [blue,ultra thick,tension=1,<->, smooth] plot coordinates {(3,4)(2,-3)(0,1)(-2,-3)(-3,4)};
\end{scope}
答案1
因为您同时使用了平滑和箭头,所以箭头会导致路径略微缩短,从而使箭头接触终点。这会导致平滑算法考虑略有不同的起点和终点,因此产生差异。或者至少我是这样认为的。我没有检查。
而是使用适当的工具:pgfplots
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center,grid=both,ymin=-5,ymax=5,xmin=-5,xmax=5]
\addplot+[domain=-3:3, no marks,<->,thick,samples=51] {4/15*x^4 -31/15*x^2+ 1};
\end{axis}
\end{tikzpicture}
\end{document}