[pstricks] Bar chart
Michael Sharpe
msharpe at ucsd.edu
Tue Jun 23 22:45:12 CEST 2009
David,
\psbarscale is what you need.
\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage{pst-bar}
\usepackage{pstricks-add}
\usepackage{filecontents}
\begin{document}
\begin{filecontents*}{dev.csv}
5/18, 5/25, 6/1, 6/15, 6/22
230, 243, 252, 267, 269
\end{filecontents*}
\psset{xunit=0.4in,yunit=0.02in}
\begin{pspicture}(0,-20)(5,80)
\psframe[fillstyle=solid,fillcolor=black!10,linestyle=solid](0,0)(5,80)
\psaxes[yticksize=0 5,ticks=y,labels=y,Dx=1,Dy=20,Oy=220](0,0)(0,0)
(5,80)
\psbarscale(1){220 sub}
\readpsbardata[header=true]{\data}{dev.csv}
\psbarchart[barstyle=blue]{\data}
\rput{90}(-1,40){PPG Regular Gasoline}
\rput(2.5,-15){Year}
\end{pspicture}
\end{document}
On Jun 23, 2009, at 1:01 PM, David Arnold wrote:
> All,
>
> I have the code below. Here is what I'd like to learn how to do. I
> want the vertical axis to scale from a minumum of 220 to a maximum
> of 280 with horizontal lines every 10 units; i.e., at 220, 230, 240,
> 250, 260, 270, and 280.
>
> Can someone show me a good way to accomplish this?
>
> \documentclass{article}
> \usepackage{amsmath}
> \usepackage{pstricks}
> \usepackage{pst-bar}
> \usepackage{pstricks-add}
> \usepackage{filecontents}
>
> \begin{document}
>
> \begin{filecontents*}{dev.csv}
> 5/18, 5/25, 6/1, 6/15, 6/22
> 230, 243, 252, 267, 269
> \end{filecontents*}
>
> \psset{xunit=0.4in,yunit=0.004in}
> \begin{pspicture}(0,-100)(5,500)
> \psframe[fillstyle=solid,fillcolor=black!10,linestyle=solid](0,0)
> (5,500)
> \psaxes[yticksize=0 5,ticks=y,labels=y,Dx=1,Dy=100](0,0)(0,0)(5,500)
> \readpsbardata[header=true]{\data}{dev.csv}
> \psbarchart[barstyle=blue]{\data}
> \rput{90}(-1,250){PPG Regular Gasoline}
> \rput(2.5,-75){Year}
> \end{pspicture}
>
> \end{document}
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
More information about the PSTricks
mailing list