# Axis labels and ticks in degree, plot in radian

I've got a plot - the x axis is in radian (from pi/2 to pi) and with gnuplot it works like a charm - the problem is - that my x-axis labeling should be in degree (-90, -75,...,90) and i'm kinda stuck.

Should i change everything to degree or is there an option to achieve this with altering the ticks?

 \documentclass{article}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}[plot/.style={very thick,raw gnuplot,mark=none,black}]
\begin{axis}[minor y tick num=3, minor x tick num=1, width=\textwidth, domain=-pi/2:pi/2,
ymin=0, ymax=1.3, xmin=-1.571, xmax=1.571, grid=both, y=5cm, axis y line=left, axis x line=bottom]
{ ag1(x) = 0.5 + 0.2*sin(10*x);plot[-pi/2:pi/2]ag1(x)};
\end{axis} \end{tikzpicture}
\end{document}


It should look similar to this picture:

-
Adding, ytick={0,0.25,...,2},yticklabel={\pgfmathparse{deg(pi*\tick)}\pgfmathprintnumbe‌​r[fixed,precision=0]{\pgfmathresult}} does something but I'm not sure if that's what you want. – percusse Jul 31 '13 at 11:39
I don't know where to add that - I tried it but ´! Undefined control sequence. \pgfplots@yticklabel ...tick )}\pgfmathprintnumber[fixed,precision=0]´ was the result. – oerpli Jul 31 '13 at 11:44
Added a picture of what I'm trying to achieve. – oerpli Jul 31 '13 at 11:46
@oerpli: Do you have a particular reason for using gnuplot? (Because PGF uses degrees by default, so that wide sidestep the problem) – Jake Jul 31 '13 at 11:49
@oerpli You add it to the end of axis options after bottom word – percusse Jul 31 '13 at 11:51

You can set gnuplot to use degrees for angles with set angles degrees;:

 \documentclass{article}
\usepackage{tikz,pgfplots}
\begin{document}

\begin{tikzpicture}[plot/.style={very thick,raw gnuplot,mark=none,black}]
\begin{axis}[
minor y tick num=3,
minor x tick num=1,
width=\textwidth,
ymin=0, ymax=1.3,
grid=both, y=5cm,
axis y line=left,
axis x line=bottom
]
set angles degrees;
ag1(x) = 0.5 + 0.2*sin(10*x);
plot [-90:90] ag1(x)
};
\end{axis} \end{tikzpicture}
\end{document}


Alternatively, you can convert your result to degrees using an x filter:

 \documentclass{article}
\usepackage{tikz,pgfplots}
\begin{document}

\begin{tikzpicture}[plot/.style={very thick,raw gnuplot,mark=none,black}]
\begin{axis}[
minor y tick num=3,
minor x tick num=1,
width=\textwidth,
ymin=0, ymax=1.3,
grid=both, y=5cm,
axis y line=left,
axis x line=bottom,
x filter/.code=\pgfmathparse{#1*360/(2*pi)}
]