# How to draw the graphs of sin x and cos x on two separate grids next to each other in TikZ

I got stuck and decided to go here. How would I draw two graphs of sin x and cos x next to each on TikZ with intervals of -2π to 2π? This seemed like something easy to do in TikZ but I'm having trouble learning how to create intervals and draw functions.

Something like this? Except I would also want to add a graph of sin x to the left of the cos x graph. I have tiny bits of code so far but have tried this to start. \documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}

\draw (-0.5,0) -- (11,0) (0,-1.5) -- (0,1.5);
\draw plot[domain=0:2*pi,smooth] (\x,{sin(\x r)});
\draw plot[domain=0:3*pi/.9,smooth] (\x,{sin(0.9*\x r)});
\end{tikzpicture}

\end{document}


Thanks!

run with xelatex:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{pst-plot}

\begin{document}

\begin{pspicture}(-3.25,-1.2)(3.5,1.5)
\psaxes[trigLabels,trigLabelBase=3,Dx=2]{->}(0,0)(-6.3,-1.1)(6.75,1.4)
\psplot[algebraic,linecolor=red,linewidth=2pt]{TwoPi neg}{TwoPi}{sin(x)}
\end{pspicture}
\begin{pspicture}(-3.5,-1.2)(3.5,1.5)
\psaxes[trigLabels,trigLabelBase=3,Dx=2]{->}(0,0)(-6.3,-1.1)(6.75,1.4)
\psplot[algebraic,linecolor=red,linewidth=2pt]{TwoPi neg}{TwoPi}{cos(x)}
\end{pspicture}

\end{document} • (Sorry for hijacking this answer.) Hi Herbert. Can/will you please give an explanation of what \pstRadUnit does? – Svend Tveskæg Oct 2 '14 at 9:32
• It is Pi/3. 0.5\pstRadUnit is Pi/6 – user2478 Oct 2 '14 at 9:54
• Thanks, Herbert! I found this code helpful and also educational. – Natalya Oct 10 '14 at 22:01

Something like this?

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis x line=center, axis y line=center, height=6cm, width=8cm] 