# How to change the label color of \psaxes?

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

\begin{document}

\begin{pspicture}(-5,-1)(5.5,5.5)
\psaxes[linecolor=gray,tickcolor=gray]{->}(0,0)(-5,-1)(5,5)[$x$,0][$y$,90]
\end{pspicture}

\end{document}


How to change the numeral label color of \psaxes from black (the default) to red (for example)?

Bonus question: Also how to change the color of the axis labels x and y? I have read the documentation at a glance but nothing can help me.

You can update the key labelFontSize to provide a generic formatting of the labels (both x and y):

\documentclass{article}
\usepackage{pst-plot}

\begin{document}

\begin{pspicture}(-5,-1)(5.5,5.5)
\psaxes[linecolor=gray,tickcolor=gray,labelFontSize=\color{red}]{->}(0,0)(-5,-1)(5,5)%
[\textcolor{blue}{$x$},0][\textcolor{green}{$y$},90]
\end{pspicture}

\end{document}

• I don't understand why there is no a semantically-correct key to change the color of \psaxes labels. labelFontSize key should be used just to change the size rather than the color. – kiss my armpit Sep 2 '14 at 20:07
• @cyanide-basedfood: It's just a hook into that part of the algorithm. You could have named it labelFont to be a bit more general, implying that you can change anything about the font (color, size, shape, ...). – Werner Sep 2 '14 at 20:26

Is the following what you are after?

\documentclass{article}

\usepackage{pst-plot}

\begin{document}

\makeatletter
\def\pst@@@hlabel#1{\textcolor{gray}{#1}}
\def\pst@@@vlabel#1{\textcolor{gray}{#1}}
\makeatother
\begin{pspicture}(-5,-1)(5.5,5.5)
\psaxes[linecolor=gray,tickcolor=gray]{->}(0,0)(-5,-1)(5,5)[\textcolor{gray}{$x$},0][\textcolor{gray}{$y$},90]
\end{pspicture}

\end{document}


• The result is what I want to achieve, but the method you used does not look as simple as tickcolor=gray. But of course +1 for your \textcolor{gray}{$x$}! – kiss my armpit Jan 23 '14 at 2:42
• @CodeMocker I agree. :) (I found it on page 25 of the manual.) – Svend Tveskæg Jan 23 '14 at 2:43