3
\draw [Bluey!160!,ultra thick, smooth,tension=0.7] plot coordinates {(-3,4)(-2,-3) (0,1)(2,-3)(3,4)};

When I draw this curve without putting arrows it looks like:

enter image description here

And after putting arrows

\draw [Bluey!160!,ultra thick, smooth,tension=0.7,<->] plot coordinates {(-3,4)(-2,-3) (0,1)(2,-3)(3,4)};

it looks like:

enter image description here

Can anyone tell me the reason?

This is the complete code

\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
    Welcome to TeX.SE. Can you add your complete MWE, please? – Sebastiano May 17 '17 at 8:05
  • 2
    Apart from @Sebastiano's comment. I would recommend using a function (polynomial here I guess) and not curve segments. – Dr. Manuel Kuehner May 17 '17 at 8:26
  • \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} – sarah hussein May 17 '17 at 12:23
  • 2
    Please edit the question and do not post code in a comment. Have a look at this gallery: pgfplots.sourceforge.net/gallery.html, It is a collection of the examples in the pgfplots manual. pgfplots is a package to draw diagrams: ctan.org/pkg/pgfplots – Dr. Manuel Kuehner May 17 '17 at 19:36
  • 2
    The code that you posted is not complete. Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Troy May 21 '17 at 9:45
2

Because you are using both smooth and arrowheads, the arrowheads are causing the path to be shortened slightly such that the arrowhead touches the final point. This causes the smoothening algorithm to consider slightly different start and final points hence the difference. Or at least I think so. I didn't check it.

Instead use the proper tool: 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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.