# latex, graph y=sin2x, use tikz [duplicate]

\begin{tikzpicture}[scale=0.5]
\draw [<->,thin] (-5,0) - - (5,0) node [right] {$x$};
\draw [<->,thin] (0,-3) - - (0,3) node [above] {$y$};

\draw[color=blue]   plot (\x,{sin(\x r)})   node[right] {$f(x) = \sin x$};
\draw[color=red]   **plot (\x,{sin(\x r)})**   node[right] {$f(x) = \sin (x+2)$};
\end{tikzpicture}


• Welcome! \draw[color=red,smooth] plot (\x,{sin(2+\x r)}) node[right] {$f(x) = \sin (x+2)$}; or \draw[color=orange,smooth] plot (\x,{sin(2*\x r)}) node[right] {$f(x) = \sin (x+2)$};? Note that in order to multiply two variables you need to use a *. – user194703 May 5 '20 at 4:18
• Try \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture}[scale=0.5] \draw [<->,thin] (-5,0) -- (5,0) node [right] {$x$}; \draw [<->,thin] (0,-3) -- (0,3) node [above] {$y$}; \draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$}; \draw[color=red,smooth] plot (\x,{sin(2+\x r)}) node[right] {$f(x) = \sin (x+2)$}; \draw[color=orange,smooth] plot (\x,{sin(2*\x r)}) node[right] {$f(x) = \sin (x+2)$}; \end{tikzpicture} \end{document}. – user194703 May 5 '20 at 4:21
• Maybe \draw[color=red,smooth] plot (\x,{sin(deg(2+\x))}) node[right] {$f(x) = \sin (x+2)$}; since TikZ uses degrees for the arguments of trigonometric functions? – user194703 May 5 '20 at 4:40