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? 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 at usgs.gov<mailto:brian_cade at usgs.gov> tel: 970 226-9326 [[alternative HTML version deleted]]
Reproducible example with data via dput? Code that you used that 'didn't work'? Error messages or output and why it was not satisfactory? Following the posting guide by providing such information is more likely to generate useful answers and save both you and those who try to help a lot of wasted time guessing. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Apr 22, 2020 at 7:32 AM Cade, Brian S via R-help <r-help at r-project.org> 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? > > 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 at usgs.gov<mailto:brian_cade at usgs.gov> > tel: 970 226-9326 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
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. -- David.> > 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 at usgs.gov<mailto:brian_cade at usgs.gov> > tel: 970 226-9326 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Cade, Brian S
2020-Apr-22 18:14 UTC
[R] [EXTERNAL] Re: overlaying graphs in xYplot (Hmisc)
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. 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 at usgs.gov<mailto:brian_cade at usgs.gov> tel: 970 226-9326 ________________________________ From: David Winsemius <dwinsemius at comcast.net> Sent: Wednesday, April 22, 2020 11:10 AM To: Cade, Brian S <cadeb at usgs.gov>; r-help <r-help at 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. -- David.> > 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 at usgs.gov<mailto:brian_cade at usgs.gov> > tel: 970 226-9326 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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]]