Graphics, Figures & TablesPSTricks | Scaling of Axes Values

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Scaling of Axes Values

Post by svend_tveskaeg »

Hi all.

On http://tug.org/PSTricks/Examples/Gallery/exa060.tex Herbert Voß has posted an example of a dataplot. After some small tweaks, the folllowing code is obtained:

Code: Select all

\documentclass{article}

\usepackage[paperwidth=8.25cm,paperheight=6.5cm,margin=0pt]{geometry}
\usepackage[svgnames]{pstricks}
\usepackage{pst-plot}
\savedata{\dataAncien}[{1,300000},{3,325000},{5,650000.0},{7,475000.0},
{9,240000.0},{11,450000.0},{13,550000.0},{15,625000.0},{17,375000.0},
{19,325000.0},{21,250000.0},{23,504311.0}]
\savedata{\dataNouveau}[{1,500000.0},{3,250000.0}]

\begin{document}

\pagestyle{empty}
\begin{pspicture}(0,-1)(8.25cm,5.5cm)
\psset{
  llx=-1.7cm,
  lly=-0.5cm,
  urx=0cm,
  ury=0cm,
  dimen=outer,
  xAxisLabel={},
  yAxisLabel={}
}
\pstScalePoints(1,1){}{1000 div}
\begin{psgraph}[
  ylabelFactor=\cdot 10^5,
  ticks=y,
  yticksize=0 24,
  ytickcolor=LightGray,
  dy=100,
  Ox=0,
  Oy=0,
  xLabels={
    ,Januar,
    ,Febuar,
    ,Marts,
    ,April,
    ,Maj,
    ,Juni,
    ,Juli,
    ,August,
    ,Septemper,
    ,Oktober,
    ,November,
    ,December,
  },
  xlabelsep=0pt,
  xLabelsRot=90
  ](0,0)(0,0)(24,700){6.25cm}{3.875cm}
\psaxes[
  linecolor=black!20,
  xAxis=false,
  ticks=none,
  labels=none
](0,0)(24,700)
\listplot[
  linecolor=blue,
  plotstyle=bar,
  barwidth=0.3cm,
  fillstyle=solid,
  fillcolor=blue
]{\dataNouveau}
\listplot[
  linecolor=red,
  linewidth=1.5pt,
  showpoints=true
]{\dataAncien}
\end{psgraph}
\end{pspicture}

\end{document}
Is it possible to get 0 instead of 0 \cdot 10^5 as the first value on the x-axes?

Thank you in advance!

P.S. I tried adding yMinValue=0 but nothing changed.

Update
"x-axes" --> "y-axes" ;)
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

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

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Scaling of Axes Values

Post by CrazyHorse »

svend_tveskaeg wrote: After some small tweaks, the folllowing code is obtained:

Code: Select all

\documentclass{article}

\usepackage[svgnames]{pstricks}
\usepackage{pst-plot}
\makeatletter
 \def\pst@@@vlabel#1{%
   \edef\@xyDecimals{\psk@yDecimals}%
   \ifodd\psk@labels % labelss=all||y (0,2)
   \else%
     \ifnum#1=0 \psvlabel{\expandafter\@LabelComma#1..\@nil}%
     \else \psvlabel{\expandafter\@LabelComma#1..\@nil\psk@ylabelFactor}%
     \fi
   \fi%
}%
\makeatother
[...]
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Scaling of Axes Values

Post by svend_tveskaeg »

Spot on (as always)!

An idea would be to put this in pst-plot as an option for the axes.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Scaling of Axes Values

Post by CrazyHorse »

svend_tveskaeg wrote:Spot on (as always)!

An idea would be to put this in pst-plot as an option for the axes.
yes, I already thought about that, but it is veeeeerrrrrry low on the to-do-list :-)
Post Reply