Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The objective is to attach \circ to each horizontal labels representing angles in degrees. How to do so? I cannot find the solution in the pst-plot manual.

\documentclass[pstricks,border=12pt,12pt,dvipsnames]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}

\FPeval\dx{pi/4}
\FPeval\Dx{round(180/pi*dx:0)}
\FPeval\dy{1}


\FPeval\XMin{0-pi/3}
\FPeval\XMax{2*pi}
\FPeval\YMin{0-3}
\FPeval\YMax{3}


\FPeval\L{XMin-dx/2}
\FPeval\R{XMax+dx/2}
\FPeval\B{YMin-dy/2}
\FPeval\T{YMax+dy/2}


\psset
{
    algebraic,
    xunit=15mm,
}


\begin{document}
\begin{pspicture}(\L,\B)(\R,\T)
    \psaxes[dx=\dx,Dx=\Dx]{->}(0,0)(\L,\B)(\R,\T)
    \psplot[linecolor=blue]{\XMin}{\XMax}{2*sin(x)}
\end{pspicture}
\end{document}

enter image description here

share|improve this question
    
Change to Tikz, and use pgfplots instead, it's more robust and versatile. (Before, I used pstricks, but now i don't change Tikz) –  skpblack Aug 23 at 20:02
    
@skpblack, if this particular OP does that, I believe the Earth might stop turning... ;-) –  Paul Gessler Aug 23 at 23:22
    
@skpblack: robustness and versatility cannot be judged without reliable data gathered via scientific researches. :-) –  In PSTricks we trust Aug 24 at 9:36

2 Answers 2

up vote 5 down vote accepted
 \psaxes[dx=\dx,Dx=\Dx,xlabelFactor={}^\circ]{->}(0,0)(\L,\B)(\R,\T)
share|improve this answer

Just for fun with pgfplots:

\documentclass[border=12pt,12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
  x={1.5cm/60},
  domain=-60:360,
  samples=100,
  axis x line=middle,
  axis y line=center,
  xmin=-70, xmax=370,
  xtick={-45,45,90,...,360},
  xticklabel={$\pgfmathprintnumber\tick^{\circ}$},
  ymin=-3.5, ymax=3.5,
  ytick={-3,-2,-1,1,2,3},
]
  \addplot[blue,mark=none] {2*sin x};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
So you are firing @cyanide-based food's own bullets at him! Sweet revenge ;-) Very good. –  Harish Kumar Aug 23 at 22:40
    
@HarishKumar of course, giving a taste of his own medicine. ;-) :-) –  Paul Gessler Aug 23 at 23:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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