Monday, 20 May 2013

Getting correct labels on axes with PSTricks

Getting correct labels on axes with PSTricks

Consider the following example.
Code
% latex test.tex
% dvips test.dvi
% ps2pdf test.ps

\documentclass{article}

\usepackage{pst-coil,pstricks-add}

\def\turister#1#2{%
 \psset{linewidth=0.075,linecolor=red}
  \psline(!#1 1990 sub 0)(!#1 1990 sub #2 190 sub)
  \psline(!#1 1990 sub 0.25 sub #2 190 sub)(!#1 1990 sub 0.25 add #2 190 sub)
}

\begin{document}

\psset{xunit=1.4,yunit=0.07}
\begin{pspicture}(8,150)
  \psaxes[labels=none,yAxis=false](1,0)
  \psaxes[Ox=1991,yAxis=false]{->}(1,0)(6.5,0)[{\AA}rstal,0][,90]
  \psaxes[xAxis=false,Oy=200,Dy=10](0,2)
  \pszigzag[coilarm=0.125,coilwidth=0.3,coilheight=0.5](0,2)(0,8)
  \psaxes[xAxis=false,Oy=200,Dy=10,ylabelFactor={\cdot 10^3}]{->}%
    (0,10)(0,7.5)(0,135)[,0][Antal norske turister,90]
  \psline[linecolor=blue](0,98)(6.5,98)
  \turister{1991}{264}
  \turister{1992}{285}
  \turister{1993}{290}
  \turister{1994}{298}
  \turister{1995}{275}
  \turister{1996}{316}
\end{pspicture}

\end{document}
Output

Question
What is the easiest way to get the same labels on the x-asix as now?
I guess writing
\psaxes[labels=none,yAxis=false](1,0)
\psaxes[Ox=1991,yAxis=false]{->}(1,0)(6.5,0)[{\AA}rstal,0][,90]
is overkill, but my attempts to get it with a single \psaxes have failed.

No comments:

Post a Comment