2
\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}

enter image description here

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.

2 Answers 2

3

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

enter image description here

\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}
2
  • 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. Sep 2, 2014 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, 2014 at 20:26
3

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}

output

2
  • 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$}! Jan 23, 2014 at 2:42
  • @CodeMocker I agree. :) (I found it on page 25 of the manual.) Jan 23, 2014 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.