Graphics, Figures & TablesCustom x-Axis Labels do not appear

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Magus
Posts: 2
Joined: Mon Nov 04, 2013 1:30 pm

Custom x-Axis Labels do not appear

Post by Magus »

Hello,

I'm quite new to LaTeX and especially PSTricks (and not a native English speaker, forgive me). I've been using a model of graph for some time. It was okay until now. I need the origin of my graph to be different from (0,0). When I set it to anything else, my custom x-axis labels, defined by xLabels, disappear. However, if I don't define custom x-labels (as shown in the code comment below), the default labels do show up.

The code is as follows:

Code: Select all

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{cite}
\usepackage[francais]{babel}
\usepackage[bookmarks=false,colorlinks,linkcolor=blue]{hyperref}
\usepackage[top=3cm,bottom=2cm,left=2cm,right=2cm]{geometry}
\usepackage[svgnames]{pstricks}
\usepackage{pst-plot}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{eso-pic}
\usepackage{array}
\usepackage{color}
\usepackage{xcolor}

\savedata{\dataODA}[{1,869.29},{2,851.10},{3,613.98},{4,613.75},{5,626.98},{6,650.43},{7,645.70},{8,863.69},{9,1224.84},{10,1224.81}]
\savedata{\dataODB}[{1,869.02},{2,867.19},{3,612.35},{4,612.93},{5,613.48},{6,626.88},{7,650.63},{8,645.71},{9,869.03},{10,1222.92}]
\savedata{\dataODC}[{1,865.99},{2,866.80},{3,611.56},{4,611.57},{5,612.24},{6,613.27},{7,628.12},{8,650.40},{9,645.69},{10,866.20}]
\savedata{\dataODD}[{1,845.07},{2,846.25},{3,611.22},{4,611.14},{5,611.09},{6,611.47},{7,612.70},{8,627.21},{9,650.04},{10,645.19}]

\begin{document}
\begin{pspicture}(-1.5,-0.3)(13.0cm,10.5cm)
\psset{llx=0.0cm,lly=0.0cm,urx=0cm,ury=0cm,dimen=outer,xAxisLabel={},yAxisLabel={CPP}}
\pstScalePoints(1,1){}{1 div}
    \begin{psgraph}[
 Dy=50.0, Ox=0, Oy=550.0, ticks=y, yticksize=0 13, ytickcolor=LightGray,
 xLabels={,$4$,$8$,$16$,$32$,$64$,$128$,$256$,$512$}, xlabelsep=2pt, xLabelsRot=0]%
 (0,550.0)(0,550.0)(13,1250.0){13.0cm}{10.00cm}
%% \begin{psgraph}[
%%  Dy=50.0, Ox=0, Oy=550.0, ticks=y, yticksize=0 13, ytickcolor=LightGray,
%%  xlabelsep=2pt, xLabelsRot=0]%
%%  (0,550.0)(0,550.0)(13,1250.0){13.0cm}{10.00cm}
\psaxes[linecolor=black!20,xAxis=none,ticks=none,labels=none](0,550.0)(13,1250.0)
\listplot[linecolor=blue,linewidth=1.5pt,showpoints=true]{\dataODA}
\listplot[linecolor=cyan,linewidth=1.5pt,showpoints=true]{\dataODB}
\listplot[linecolor=green,linewidth=1.5pt,showpoints=true]{\dataODC}
\listplot[linecolor=yellow,linewidth=1.5pt,showpoints=true]{\dataODD}
\end{psgraph}
\end{pspicture}

\end{document}
I had a look at the pst-plot documentation and did some searching, but couldn't solve the problem.

Does anybody have a clue?

Thanks in advance
Last edited by localghost on Mon Nov 04, 2013 1:55 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Custom x-Axis Labels do not appear

Post by localghost »

At the moment I can't offer a direct solution. But perhaps this approach is acceptable. It features exponential x-axis labels with a base of "2". The output is attached.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[svgnames]{pstricks}
\usepackage{pstricks-add}
\usepackage{pst-plot}

\savedata{\dataODA}[{0,869.29},{1,851.10},{2,613.98},{3,613.75},{4,626.98},{5,650.43},{6,645.70},{7,863.69},{8,1224.84},{9,1224.81}]
\savedata{\dataODB}[{0,869.02},{1,867.19},{2,612.35},{3,612.93},{4,613.48},{5,626.88},{6,650.63},{7,645.71},{8,869.03},{9,1222.92}]
\savedata{\dataODC}[{0,865.99},{1,866.80},{2,611.56},{3,611.57},{4,612.24},{5,613.27},{6,628.12},{7,650.40},{8,645.69},{9,866.20}]
\savedata{\dataODD}[{0,845.07},{1,846.25},{2,611.22},{3,611.14},{4,611.09},{5,611.47},{6,612.70},{7,627.21},{8,650.04},{9,645.19}]

\begin{document}
  \psset{llx=-1.2cm,lly=-1.2cm,urx=0.5cm,ury=0.5cm,dimen=outer,xAxisLabel={},yAxisLabel={CPP}}
  \begin{psgraph}[
    Dy=50.0,
    Ox=0,
    Oy=550.0,
    ticks=y,
    yticksize=0 10,
    ytickcolor=LightGray,
    xlogBase=2,
    xlabelsep=2pt,
    xLabelsRot=0
  ] (0,550.0)(0,550.0)(10,1250.0){10.0cm}{10.00cm}
    \listplot[linecolor=blue,linewidth=1.5pt,showpoints=true]{\dataODA}
    \listplot[linecolor=cyan,linewidth=1.5pt,showpoints=true]{\dataODB}
    \listplot[linecolor=green,linewidth=1.5pt,showpoints=true]{\dataODC}
    \listplot[linecolor=yellow,linewidth=1.5pt,showpoints=true]{\dataODD}
  \end{psgraph}
\end{document}

Best regards and welcome to the board
Thorsten
Attachments
utmp.png
utmp.png (8.48 KiB) Viewed 5938 times
Magus
Posts: 2
Joined: Mon Nov 04, 2013 1:30 pm

Re: Custom x-Axis Labels do not appear

Post by Magus »

Thanks for your reply.

I hadn't considered that. Indeed, a logarithmic scale is a good solution since my x-axis values are powers of 2. Although the "disappearing custom labels" mystery remains to be solved, I'll stick to your solution.

Thanks again.
Post Reply