[pstricks] Labeling axes

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Sun Feb 6 17:03:21 CET 2005


Vince McGarry wrote:

> What is the most efficient way to label the horizontal axis in radians, ie,
> -2pi, -7pi/4, etc., intead of default degrees? I am doing this by writing a
> long \ifnum switch to set \pshlabels's, but it seems to me that there must
> be a more efficient way I haven't thought of.


\listfiles
\documentclass{article}

\usepackage{pstricks}
\usepackage{pstricks-add}

\makeatletter
\def\pshlabel#1{\small%
     \pst at mod{#1}{2}\tempa%              0 oder 1
     \ifnum1>\tempa%                     ungerade?
        \count1=#1\divide\count1 by 2%   #1/2
         $\the\count1\pi$%               n*pi
     \else$\frac{#1}{2}\pi$\fi}%         n/2*pi
\makeatother

\begin{document}

\begin{pspicture}(-0.5,-1.25)(10,1.25)
 
\psaxes[xunit=1.570796327,showorigin=false]{->}(0,0)(-0.5,-1.25)(6.4,1.25)
   \psplot[linecolor=red,linewidth=1.5pt]{0}{9.424777961}{x 180 mul 
3.141592654 div sin}
\end{pspicture}

\end{document}


Herbert



-- 
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes




More information about the PSTricks mailing list