# [pstricks] Special x-axis values

Alan Ristow ristow at ece.gatech.edu
Wed Jul 25 15:07:25 CEST 2007

Christoph Bersch wrote:
> Hi,
>
> I want to use special x-axis values like it's shown in
> http://tug.org/PSTricks/main.cgi?file=pst-plot/psaxes#ChemElements.
>
> My problem now is, that I have a datafile that I want to plot, and the
> x-values are in the range from -0.5 to 0.5 and the x-axis should have
> the values
> -T/2 -T/4 0 T/4 T/2
>
> The following does not work properly as the indexing of the label array
> is wrong. How do I have to change the example?

The following works for me. I must admit that it is not entirely clear
to me why it is necessary to redefine *both* \pshlabel and
\pst@@@hlabel, and I don't really have time to look into it any further
just now, but it seems to do the job. Also note the changes I made to

Alan

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\makeatletter
\def\pst@@@hlabel#1{\small\textcolor{red}{\NewYLabels(#1)}}
\makeatother
\renewcommand{\pshlabel}[1]{\NewYLabels(#1)}%
%
\usepackage{arrayjob}
\usepackage{nicefrac}
\begin{document}
%
\newarray{\NewYLabels}
\readarray{NewYLabels}{-\nicefrac{T}{2} & -\nicefrac{T}{4} & 0 &
\nicefrac{T}{4} & \nicefrac{T}{2}}
%
\psset{xunit=2cm}%
\begin{pspicture}(-0.5,-3)(0.55,3)%
\psset{Dx=1}%
\psaxes{->}(0,0)(0,-3.5)(6,3.5)%
\end{pspicture}%
\end{document}