# Custom Labels right side of the axis

I am having problems with custom labels and its position, especially with negative values in the coordinates. I do not get the position on the right side of the y axis and its height is shifted if the start is negative. Do you have a solution for this?

% !TeX program = xelatex

\documentclass{scrartcl}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}

\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[ylabelPos=right](0,0)(3,3.4)
\rput(2,1){position ok}
\psline[linecolor=red,ylabelPos=right](0,0)(0,-1)(1,-1)
\end{pspicture}
%
\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[yLabels={A,B,C,D},ylabelPos=right](0,0)(3,3.4)
\rput(2,1){position not ok}
\rput(2,0.5){labels on left side}
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\end{pspicture}

\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[ylabelPos=right,Oy=-1](0,-1)(3,2.4)
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\rput(2,1){position ok}
\end{pspicture}
%
\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[yLabels={A,B,C,D},ylabelPos=right](0,-1)(3,2.4)
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\rput(2,1){position not ok}
\rput(2,0.5){labels on left side}
\rput(2,0){and shifted down}
\end{pspicture}

Red Corner for Reference Position
\end{document}

• It looks like a bug: it you use the default labels, this doesn't happen. – Bernard Jul 16 '19 at 13:44
• The position test for special labels is missing. I'll upload a new version to CTAN at evening. – user187802 Jul 16 '19 at 15:22

Will be fixed as soon as possible:

\documentclass{scrartcl}
\usepackage{pstricks}
\usepackage{pst-plot}
\makeatletter\def\pst@vlabels#1#2#3#4{%
\ifSpecialLabelsDone\else
\ifx\empty\psk@yLabels
\ifdim#1=\z@\else
\pst@cnta=#1\relax           %      % Distance (in sp) to end.
\divide\pst@cnta\psk@dy\relax%   % Number of ticks/labels
\ifnum\pst@cnta=\z@\else
\pst@dima=\psk@dy sp%            % Space between ticks.
\ifodd\number\psk@labels\else\ifPst@yAxis\pst@@vlabels\fi
\fi
\showoriginfalse
\fi
\fi
\else
\pstFPsub\pst@pmtempa{#4}{#3}%
\pstFPDiv\pst@pmtempb{\pst@pmtempa}{\psk@Dy}%
\ifdim\pst@pmtempb pt < \z@
\def\pst@pmtempe{\pst@int{\pst@pmtempc}}\else\def\pst@pmtempe{\pst@int{\pst@pmtempd}}\fi
\multido{\nA=0+1,\rA=#3+\psk@Dy}{\pst@pmtempe}{%
\ifdim \nA pt < \z@ \def\nB{-\nA}\else \def\nB{\nA}\fi
\ifnum\psk@ylabelPos=0
\uput{\psylabelsep}[180]{\pst@yLabelsRot}(0,\rA){%
\strut\expandafter\psvlabel\expandafter{\psPutYLabel{\nB}}}%
\else
\uput{\psylabelsep}[0]{\pst@yLabelsRot}(0,\rA){%
\strut\expandafter\psvlabel\expandafter{\psPutYLabel{\nB}}}%
\fi
}%
\SpecialLabelsDonetrue
\fi
\fi
}
\makeatother
\begin{document}

\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[ylabelPos=right](0,0)(3,3.4)
\rput(2,1){position ok}
\psline[linecolor=red,ylabelPos=right](0,0)(0,-1)(1,-1)
\end{pspicture}
%
\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[yLabels={A,B,C,D},ylabelPos=right](0,0)(3,3.4)
\rput(2,1){position not ok}
\rput(2,0.5){labels on left side}
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\end{pspicture}

\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[ylabelPos=right,Oy=-1](0,-1)(3,2.4)
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\rput(2,1){position ok}
\end{pspicture}
%
\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[yLabels={,A,B,C,D},ylabelPos=right](0,-1)(3,2.4)
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\rput(2,1){position not ok}
\rput(2,0.5){labels on left side}
\rput(2,0){and shifted down}
\end{pspicture}

Red Corner for Reference Position

\begin{pspicture}(-1,-3)(3,2.4)
\psaxes[yLabels={,A,B,C,D}](0,-1)(3,2.4)
\psline[linecolor=red](0,0)(0,-1)(1,-1)
\rput(2,1){position not ok}
\rput(2,0.5){labels on left side}
\rput(2,0){and shifted down}
\end{pspicture}

\end{document}


• In the last axis the label "D" missing. I run the code and removed the first comma. This produces the "A" label shifted one place downwards and the D to be on the penultimate place. But this could be workarounded by a linear shift of the data. – Niklas Jul 17 '19 at 19:52
• the dataset is a replacement for the integers, here -1=A and so on. I used the leading , only just for one. -1=<empty> in this case and D will not be printed. – user187802 Jul 18 '19 at 4:47