3

I am trying to display textual labels on my X axis, but they are missing:

\begin{figure}[H]
\begin{center}
\psset{xunit=1.5,yunit=0.5}
\begin{pspicture}(0,-11)(7,2)
\psaxes[ticksize=0 5pt,Dy=2,Dx=1,Ox=0,Oy=0,xLabelsRot=45,xlabelPos=top,mathLabel=false,xLabels={,A1,A2,A3,A4,A5,A6}]{-}(0,0)(0,-11)(7,1.9)
\readdata\dataA{Ressources/experience1A.dat}
\readdata\dataB{Ressources/experience1B.dat}
\listplot[plotstyle=dots,linecolor=orange]{1 0.09 \dataA}
\listplot[linecolor=orange,linewidth=1.5pt,plotstyle=cspline]{1 0.09 \dataA}
\listplot[plotstyle=dots,linecolor=blue]{1 -3.95 \dataB}
\listplot[linecolor=blue,linewidth=1.5pt,plotstyle=cspline]{1 -3.95 \dataB}
\end{pspicture}
\caption Visualisation de la différence en pourcent avec les valeurs natives
\end{center}
\end{figure}

Displays this:

xlabels are missing

I cannot get the labels on the X axis to show up. Any ideas? I already tried to define each axis on its own, seen on this thread.

Also, why does the caption break the line after one letter (happens in my whole document)?

  • 1
    Re. second point: use \caption{Visualisation....} - note the braces to group the argument - without them \caption just takes the next token - ie the first letter. – Thruston May 02 '16 at 21:52
  • 1
    Also, you should use \centering instead of \begin{center}...\end{center} for a figure environment. Sorry I don't know the answer to your question, but it's a better practice. – Arun Debray May 02 '16 at 22:01
  • Alright, I will. I've always wondered when to use \centering instead of \begin{center}..., thanks for the link. – R. Winden May 02 '16 at 22:19
  • I'll have a look into the code at weekend to see what's going wrong. –  May 03 '16 at 19:08

2 Answers2

1

I do not have your data files, so I commented the corresponding part of the code. The problem seems to come from the fact xLabels seem to work only if only one pair of coordinates is allowed, as though the other necessarily were $(0,0)$. So I first drew ‘normal axes’, given by 3 pairs of coordinates, without the x labels, then a single x axis with its labels. I added babelto have a correct formatting of the caption, since you write in French:

\documentclass[x11names, french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}

\usepackage{pstricks-add} \usepackage{auto-pst-pdf}

\begin{document}

\begin{figure}[H] \centering \psset{xunit=1.5,yunit=0.5} \begin{pspicture}(-2,-11)(7,4) \psaxesticksize=0 5pt, Dy=2, Dx=1, Ox=0, Oy=0, labels=y(0,-11)(7,1.9) \psaxesyAxis = false, ticks =none, labels = none, xLabels={,A1,A2,A3,A4,A5,A6},xLabelsRot=45, xlabelPos=t, labelsep =3pt, mathLabel=false %\readdata\dataA{Ressources/experience1A.dat} %\readdata\dataB{Ressources/experience1B.dat} %\listplot[plotstyle=dots,linecolor=orange]{1 0.09 \dataA} %\listplot[linecolor=orange,linewidth=1.5pt,plotstyle=cspline]{1 0.09 \dataA} %\listplot[plotstyle=dots,linecolor=blue]{1 -3.95 \dataB} %\listplot[linecolor=blue,linewidth=1.5pt,plotstyle=cspline]{1 -3.95 \dataB} \end{pspicture} \caption{Visualisation de la différence en pour cent avec les valeurs natives} \end{figure}

\end{document}

enter image description here

Bernard
  • 271,350
  • That's great, thank you! Is it possible to put the labels above the axis with this solution? The xlabelPos seems to have no effect.. – R. Winden May 03 '16 at 06:20
  • I tried, changing several parameters and none worked (xlabelPos, xlabelsep). It is possible with the ‘natural’ labels. Maybe you should ask the author of pst-plot. – Bernard May 03 '16 at 10:19
0

That was a bug. With the upcoming TL2016 you'll get:

enter image description here

The new pst-plot.tex is available here: http://comedy.dante.de/~herbert/TeXnik/tex/generic/pst-plot/