[pstricks] pst-bar With Non-Numeric Data?
Alan Ristow
alan at ristow.info
Thu Jun 2 15:51:45 CEST 2011
On 6/1/2011 11:59 PM, Rich Shepard wrote:
> Reading the pst-bar doc tells me that the external data file must have
> only numeric values following the header line. This makes me ask if
> PSTricks
> is the appropriate tool to produce a bar chart/histogram for precipitation
> amounts at a station.
>
> The data consist of a date (from 2008-01-01 through 2010-12-31 inclusive)
> and the precipitation amount (comma separated). However, there are 50 dates
> for which no measurements are available. A pst-bar data file constraint is
> that each row have the same number of elements. Having no measurement is
> different from a recorded 0.00 and the file currently uses NA for use in R.
When I first wrote pst-bar I considered how to deal with this and other
sorts of statistical data sets. Ultimately, I decided that the purpose
of pst-bar should be to produce bar charts with a visual appearance
compatible with the surrounding text and other graphics in the document.
Accordingly, I left out data processing almost entirely, assuming that
pst-bar would work only with preprocessed data.
I'm not sure how you intend to use the NA values in your bar chart, but
as I recall -- and I admit it has been a long time since I looked at the
code -- if you give pst-bar a value of 0.00 it will draw no bar at all.
Therefore, I wonder if you cannot just change your NAs to 0.00s? Of
course, the drawback if you're doing analysis with R is that the NAs
matter and you'll be stuck maintaining two versions of the same file
(though it seems like I remember a file manipulation package on CTAN
that might allow you to convert the NAs on the fly -- sorry, I haven't
been very active in the LaTeX community the past few years and I cannot
think of what it might be called).
> Because my data violate the two pst-bar constraints (only numeric and the
> same elements on each row), I'd appreciate suggestions on how to illustrate
> these data effectively.
If you are not tied to plotting your data with PSTricks and you are
using R for analysis anyway, why not create the bar chart with R?
Alan
More information about the PSTricks
mailing list