3

I am trying to redefine the labels for x-axis in a pst-plot diagram by putting

\makeatletter
\def\ps@@@hlabel#1{\small(#1)}
\makeatother

in the preamble (see top of page 25 in the manual) but then no labels are printed at all.

Example:

\documentclass{article}

\usepackage{pst-plot}

% Label redefinition. (NOT working)
\makeatletter
\def\ps@@@hlabel#1{\small(#1)}
\makeatother

% Makes things easier.
\def\afspil#1#2{%
%  \rput(!2 #1 mul -0.3){\small{(#1)}}  <--  (`manually' plotting of labels)
  \psline[linecolor=red](!2 #1 mul 0)(!2 #1 mul #2)
  \psline[linecolor=red](!2 #1 mul 0.2 sub #2)(!2 #1 mul 0.2 add #2)
}

\begin{document}

\begin{pspicture}
  \psaxes[
    labels=none,
    ticks=y,
    ticklinestyle=dotted,
    tickwidth=0.5pt,
    yticksize=0 12.9
  ]{->}(0,0)(-0.3,-0.3)(13.1,8.6)[Sang,0][Afspilninger,90]
  \psaxes[
    dy=1,
    Dy=10,
    labels=y,
    ticks=y,
    ylabelFactor=\cdot 10^3
  ](0,0)(-0.3,-0.3)(13.1,8.6)
  \afspil{1}{6.4098}
  \afspil{2}{5.0320}
  \afspil{3}{7.5437}
  \afspil{4}{6.3253}
  \afspil{5}{0.5735}
  \afspil{6}{6.9024}
\end{pspicture}

\end{document}

How do I redefine the labels on the x-axis?

3
+150

There are two things: first you draw two axes with only y-labels, and the macro, which you need to change is \pst@@@hlabel. It is correct in the text of page 25, but wrong in the example following the paragraph. The following works:

\documentclass{article}

\usepackage{pst-plot}

% Label redefinition.
\makeatletter
\def\pst@@@hlabel#1{\small(#1)}
\makeatother

% Makes things easier.
\def\afspil#1#2{%
%  \rput(!2 #1 mul -0.3){\small{(#1)}}  <--  (`manually' plotting of labels)
  \psline[linecolor=red](!2 #1 mul 0)(!2 #1 mul #2)
  \psline[linecolor=red](!2 #1 mul 0.2 sub #2)(!2 #1 mul 0.2 add #2)
}

\begin{document}

\begin{pspicture}
  \psaxes[
    labels=none,
    ticks=y,
    ticklinestyle=dotted,
    tickwidth=0.5pt,
    yticksize=0 12.9
  ]{->}(0,0)(-0.3,-0.3)(13.1,8.6)[Sang,0][Afspilninger,90]
  \psaxes[
    dy=1,
    Dy=10,
    ylabelFactor=\cdot 10^3
  ](0,0)(-0.3,-0.3)(13.1,8.6)
  \afspil{1}{6.4098}
  \afspil{2}{5.0320}
  \afspil{3}{7.5437}
  \afspil{4}{6.3253}
  \afspil{5}{0.5735}
  \afspil{6}{6.9024}
\end{pspicture}

\end{document}
| improve this answer | |
1

If you just want to change the size of the label numbers, you can use the keyval labelFontSize=\scriptstyle. To use this, you have to load the package pstricks-add.

Example:

\documentclass{article}

\usepackage{pst-plot,pstricks-add}
\begin{document}

\psset{xunit=1.3cm,yunit=0.6cm,algebraic=true,dotstyle=*,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-1,-4.3)(9,10)
\psgrid[subgriddiv=0,gridcolor=gray,gridwidth=0.4pt,griddots=0,gridlabels=0pt](-1,-4)(9,10)
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=1,Dy=1,ticksize=-3pt 0,subticks=2]{->}(0,0)(0,-4)(9,10)
\psplot[plotpoints=200,linecolor=black,algebraic]{0}{9}{(3-3*x)*2.718^(2-x)}
\end{pspicture*}

\end{document}
| improve this answer | |
  • 1
    Welcome to TeX.SX! Could you show an screen shot of the output of your code in order to prove it's an answer? ;-) – user31729 Feb 24 '15 at 22:53

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.