[R] overlaying graphs in xYplot (Hmisc)
dw|n@em|u@ @end|ng |rom comc@@t@net
Wed Apr 22 19:10:16 CEST 2020
On 4/22/20 7:31 AM, Cade, Brian S via R-help wrote:
> Hi All. I am trying to construct a graph using the xYplot() function in Hmisc package (thank you Frank Harrell) taking advantage of the Cbind() argument for plotting the median, 10th, and 90th quantiles and also the cbind() argument for individual data values. I know how to do both of these separately, but I would really like to have them overlayed on each other. I've tried various approaches with add=T, new=T, etc and none of those seem to work with xYplot(). Any pointers?
I don't know the answer and you have presented no data or code, so I'm
just going to address the question in the most halting and vague manner
by first looking at the code and then looking at the documentaion.
(That's possibly the reverse of the proper order.) The plotting
functions in pkg:Hmisc can be in any of the three plotting paradigms. If
you look at the code for xYplot it becomes almost immediately obvious
that it is operative within the lattice plotting paradigm. (That means
that using `new=T` or `add=T` would not work since those are base
I'm not sure what the term "Cbind argument" might mean to you (and I've
never used it), but I suspect you are intending to use a call to `Cbind`
on the left hand side of a formula argument for xYplot.
Re: The goal of "plotting the median, 10th, and 90th quantiles and also
the cbind() argument for individual data values."
It appears to me from the documentation that you would be expected to do some pre-processing to aggregate your data into a summary format by groups before plotting and then use named arguments to Cbind to designate the appropriate columns to be used for median and the outer quantiles. See the example using the dataset named dfr in the ?xYplot page following these comments:
# The following example uses the summarize function in Hmisc to
# compute the median and outer quartiles. The outer quartiles are
# displayed using "error bars"
It should be trivial to modify the call to `summarize` to get .1 and .9 quantiles instead of quartiles.
> Brian S. Cade, PhD
> U. S. Geological Survey
> Fort Collins Science Center
> 2150 Centre Ave., Bldg. C
> Fort Collins, CO 80526-8818
> email: cadeb using usgs.gov<mailto:brian_cade using usgs.gov>
> tel: 970 226-9326
> [[alternative HTML version deleted]]
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help