[Tex/LaTex] Plotting Trigonometric Functions

pstricks

I was trying to plot graph of sine functions. I found PSTricks and tried using it, but I have no idea whether there are more standard / more appropriate packages to do this.

Here is what I did (which was miserable):

\psset{unit=1cm}
\begin{center}
\begin{pspicture}(-3.5,-2)(6.5,2)
    \psaxes[dx=\pstPI4,trigLabelBase=2,trigLabels]{->}(0,0)(-3.2,-1.25)(6.5,1.25)
    \psplot[xunit=0.5cm,linecolor=red,linewidth=1.5pt,plotpoints = 100]{-\psPiTwo}{\psPiFour}{x RadToDeg sin}
\end{pspicture}
\end{center}

Would any of you mind giving me some suggestions on how to make this better? I actually don't really understand why I need to put {-\psPiTwo}{\psPiFour} in the part where it is, but I tried changing that to some other things and they do not seem to work well.

Thanks!

Best Answer

Here is something that should get you going.

\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
grid=both,
domain=-2*pi:2*pi,
samples=200,
no marks,
xticklabels={-2$\pi$,-1.5$\pi$,...$\pi$,2$\pi$},
xtick={-6.2832,-4.7124,...,6.2832},
x post scale=1.5
]
\addplot {2*sin(deg(x))+0.8*sin(pi*deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here