[R] [EXTERNAL] Re: overlaying graphs in xYplot (Hmisc)
deep@y@n@@@rk@r @end|ng |rom gm@||@com
Sat Apr 25 13:12:57 CEST 2020
On Wed, Apr 22, 2020 at 11:44 PM Cade, Brian S via R-help
<r-help using r-project.org> wrote:
> All the xYplot() functions using Cbind() or cbind() does just exactly what I want (Cbind
> provides aplot of 3 summary statistics and cbind provides the raw values). I just cannot
> find anyway to overlay them.
You are not really helping yourself by not providing reproducible code.
If you are lucky, the following might give you what you want:
p1 <- xYplot(...) # your first plot
p2 <- xYplot(...) # your second plot
p1 + p2
Or it might not.
> 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
> From: David Winsemius <dwinsemius using comcast.net>
> Sent: Wednesday, April 22, 2020 11:10 AM
> To: Cade, Brian S <cadeb using usgs.gov>; r-help <r-help using r-project.org>
> Subject: [EXTERNAL] Re: [R] overlaying graphs in xYplot (Hmisc)
> 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
> plotting strategies.)
> 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
> > 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
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> [[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