[pstricks] Shifting origin does not shift labels
Alan Ristow
ristow at ece.gatech.edu
Wed Mar 29 20:28:23 CEST 2006
I received an email from a user of pst-bar yesterday complaining that
when the origin is shifted, the bars shift with it while the bar labels
do not. I have constructed the following minimal example that
illustrates the problem:
\documentclass{minimal}
\usepackage{filecontents}
\usepackage{pstricks,pst-bar}
\listfiles
\begin{filecontents*}{test_bar.dat}
A,B,C,D
4,5,2,9
\end{filecontents*}
\begin{document}
\psset{xunit=0.3in,yunit=0.5in}%
\begin{pspicture}(0,0)(4,10)%
\readpsbardata{\data}{test_bar.dat}%
\psbarchart[origin={4,4},barstyle={red,blue},barlabelrot=45,%
orientation=horizontal]{\data}
\end{pspicture}
\end{document}
If "origin={4,4}" is removed from \psbarchart (or set to {0,0}), the bar
labels appear where they should.
Upon further investigation, I discovered that the misplaced labels are a
result of pst-bar using \uput to place them. It seems that \uput does
not pay any attention to shifting of the origin. I also noted that
\psaxes does *not* use \uput to place its axis labels, so I thought I
could use the same strategy in pst-bar. However, a simple test shows
that \psaxes suffers from the same problem:
\documentclass{minimal}
\usepackage{filecontents}
\usepackage{pstricks,pst-bar}
\listfiles
\begin{filecontents*}{demo1.dat}
0 1
5 1.50000000
10 2.50000000
15 2.75000000
20 3.15000000
25 5.75000000
\end{filecontents*}
\begin{document}
\psset{xunit=0.2in,yunit=0.8in}%
\begin{pspicture}(0,0)(25,6)%
\psaxes[origin={4,4},axesstyle=frame,Ox=0,Oy=0,Dx=5,Dy=1]%
(0,0)(25,6)%
\readdata{\data}{demo1.dat}%
\listplot{\data}%
\end{pspicture}
\end{document}
The PS resulting from this code shows the axes shifted according to the
origin parameter, but neither the data plot nor the axes labels are shifted.
Since it affects \psaxes, I'm guessing it is fundamental to the design
of PSTricks and maybe it cannot be easily changed or worked around. The
manual says that shifting the origin applies only to "pure graphics
objects" -- does this mean that text placement is unaffected?
At any rate, if anyone can shed some light on this or suggest a
workaround, I would appreciate it. On the other hand, if the rest of
PSTricks is similarly affected then I am inclined to simply tell the
user that shifting the origin will not work with \psbarchart....
Alan
More information about the PSTricks
mailing list