Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard
On Fri, 24 Aug 2018, Richard M. Heiberger wrote: color for the legend comes from trellis.par.get You can control that for an individual plot with the par.settings argument. tmp <- data.frame(y=sample(10), group=rep(c("Median", "Maximum"), each=5), year=factor(re

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard
On Fri, 24 Aug 2018, Bert Gunter wrote: For the legend, you can use the full "key" argument for more control. Bert, This I did. For the scales, again, the docs provide the answer: the "at" and "labels" components of "x" component of the scales lists can explicitly control the x -labels,

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Bert Gunter
For the legend, you can use the full "key" argument for more control. The docs in ?xyplot for "key" Should answer your questions. "col" controls text color within the "text" component and rectangle color within the "rectangle" component , for example. I think this should work as an alternative to

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Richard M. Heiberger
color for the legend comes from trellis.par.get You can control that for an individual plot with the par.settings argument. tmp <- data.frame(y=sample(10), group=rep(c("Median", "Maximum"), each=5), year=factor(rep(1998:1999, length=10))) barchart(y ~ year, da

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard
On Wed, 22 Aug 2018, Rich Shepard wrote: More when I have results. Almost there. I've read the auto.key section in ?barchart and looked at examples from stackoverflow on the web without seeing my syntax errors. I would like help on two issues: 1. What I want is to have the legend text in

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: groups = Summary.Type, ... in your call will then do the job. As an aside, this is a good example of why you should adhere to this format for data analysis in R. Bert, Progress and retreat. I'm putting this aside for a day or so because I need t

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: (I know that you said your post may already be "out of date", but ...) Bert, Still reading ?xyplot/?barchart. But ?barchart says: "Formally, if groups is specified, then groups along with subscripts is passed to the panel function, ..." which, as I

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Bert Gunter
(I know that you said your post may already be "out of date", but ...) " Despite additional reading of barchart() examples and help pages I'm still missing how to get grouping working and use the years in the dataframe as labels on the x-axis." But ?barchart says: "Formally, if groups is specif

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Rich Shepard wrote: Correcting the barchard() command fixed the main issue; getting the second set of bars is still eluding me, but I'll continue working on fixing this. I'll get the years as the x-axis labels rather than year number in sequence from 1 to 29. Despite add

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: See inline. Bert, Will do. Sent a reply before seeing this. More to follow. Thanks, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Bert Gunter
See inline. -- Bert On Wed, Aug 22, 2018 at 9:17 AM Rich Shepard wrote: > On Wed, 22 Aug 2018, Bert Gunter wrote: > > > No reproducible example (see posting guide below) so minimal help. > > Hi Bert, > >I thought the header and six data rows of the dataframe plus the syntax > of > the com

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: No reproducible example (see posting guide below) so minimal help. Hi Bert, I thought the header and six data rows of the dataframe plus the syntax of the command I used were sufficient. Regardless, here's the dput() output: structure(list(Year = c(1

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Bert Gunter
No reproducible example (see posting guide below) so minimal help. Remove the quotes from your formula. Why did you think they should be there? -- see ?formula. Read the relevant portions of ?xyplot carefully (again?). You seemed to have missed: "*Primary variables:* The x and y variables should

[R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
I've not before created bar charts, only scatter plots and box plots. Checking in Deepayan's book, searching the web, and looking at ?barchart has not shown me the how to get the results I need. The dataframe looks like this: head(stage_heights) Year Med Max 1 1989 91.17 93.32 2 1990

Re: [R] Lattice barchart legend with panel.barchart

2016-07-27 Thread Duncan Mackay
2) ) ) Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Seth Bigelow Sent: Thursday, 28 July 2016

[R] Lattice barchart legend with panel.barchart

2016-07-27 Thread Seth Bigelow
I have constructed a barchart that requires a panel call, but the panel reduces the facsimiles of bars in the legend to small colored circles. You can see this behavior in the following example: Titan <- as.data.frame(Titanic) titanpanel <- function(x,y,...){ panel.barchart(x,y,...) } barchart(C

Re: [R] Lattice Barchart

2014-02-16 Thread Richard M. Heiberger
Pete, Thank you for this example. I recommend using the likert function in the HH package. d2 <- structure(c(1000, 2000, 2500, 5000, 1000, 2000, 3000, 2000, 200, 600, 1000, 900), .Dim = c(4L, 3L), .Dimnames = list(c("1/1/2014", "2/1/2014", "3/1/2014", "4/1/2014"), c("A", "B", "C"))) d2 likert

Re: [R] Lattice Barchart

2014-02-16 Thread Pete Brecknock
Pete Brecknock wrote > Hi > > The code below plots a stacked barchart. > > I would like to overlay on this chart a circular plotting character at the > sum of the bars for each month. The plotted characters should be joined > with a line. > > So, for "1/1/2014", I would like to see a point at 2

Re: [R] Lattice barchart with error bars

2013-07-08 Thread S Ellison
> > Anyone know what the 95% confidence > > interval of the median would be? For an R answer you could get one for each group from wilcox.test( , conf.int =TRUE ) and build that into an alternative boxplot stats function which you could specify in your bwplot call. Steve Ellison

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Bert Gunter
This is not an R question. Read the references. Bert Sent from my iPhone -- please excuse typos. On Jul 5, 2013, at 12:15 PM, Shaun Jackman wrote: > Hmm. Interesting point, Bert. I don't know whether the notches show > the 95% confidence interval or the median, or the 95% confidence > interva

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
Hmm. Interesting point, Bert. I don't know whether the notches show the 95% confidence interval or the median, or the 95% confidence interval that two non-overlapping notches have different medians. You're saying it's the latter? Anyone know what the 95% confidence interval of the median would be?

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
Yes! Thank you, David. That's exactly what I'm I'm looking for. For the record, here's a couple pages leading to this answer: http://www.hep.by/gnu/r-patched/r-faq/R-FAQ_89.html http://latticeextra.r-forge.r-project.org/man/segplot.html http://rgm3.lab.nig.ac.jp/RGM/r_function?p=latticeExtra&f=seg

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Bert Gunter
Be careful! You are talking about 2 different varieties of apples here. As I read it, the CI's in the cancer data, which I know is just for example purposes, are CI's for the **individual means**; the notches in boxplots are nonparametric and for 2 groups with roughly equal sample sizes, "The ide

Re: [R] Lattice barchart with error bars

2013-07-05 Thread David Winsemius
On Jul 5, 2013, at 11:15 AM, Shaun Jackman wrote: > Hi Bert, Dennis, > > I'll agree that using a barchart was a poor choice. I was in fact using a > notched bwplot to show the median and confidence interval of the median. In > this case it's the median and confidence interval that I want to high

Re: [R] Lattice barchart with error bars

2013-07-05 Thread Shaun Jackman
Hi Bert, Dennis, I'll agree that using a barchart was a poor choice. I was in fact using a notched bwplot to show the median and confidence interval of the median. In this case it's the median and confidence interval that I want to highlight, and I find that the visual noise of the box and whisker

Re: [R] Lattice barchart with error bars

2013-07-04 Thread Bert Gunter
Shaun: I understand that this type of plot is standard in many disciplines, but it really is awful (google on 'Dynamite plots' for some more erudite perspectives). Have you considered bwplot() for your unaggregated data instead? (No need to reply. It's July 4, and I'm just waving a little flag fo

[R] Lattice barchart with error bars

2013-07-04 Thread Shaun Jackman
Hi, I'd like to draw a lattice barchart of means with error bars to show the standard deviation. I have the barchart, how do I add the error bars? require(datasets) require(lattice) x <- aggregate(weight ~ Diet, ChickWeight, function(x) c(mean=mean(x), sd=sd(x))) barchart(weight[,'mean'] ~ Diet,

Re: [R] Lattice: barchart, error bars and grouped data

2010-03-10 Thread Johannes Graumann
Thanks. I switched to ggplot2 which offers error bars. Joh Dieter Menne wrote: > > > Johannes wrote: >> >> >> How can I, given the code snippet below, draw the error bars in the >> center of each grouped bar rather than in the center of the group? >> > > http://markmail.org/message/oljgimk

Re: [R] Lattice: barchart, error bars and grouped data

2010-03-08 Thread Dieter Menne
Johannes wrote: > > > How can I, given the code snippet below, draw the error bars in the center > of each grouped bar rather than in the center of the group? > http://markmail.org/message/oljgimkav2qcdyre Dieter -- View this message in context: http://n4.nabble.com/Lattice-barchart-erro

[R] Lattice: barchart, error bars and grouped data

2010-03-08 Thread Johannes Graumann
Hi, How can I, given the code snippet below, draw the error bars in the center of each grouped bar rather than in the center of the group? Thanks for any hints, Joh library(lattice) barley[["SD"]] <- 5 barchart( yield ~ variety | site, data = barley, groups=year, origin=0, lowDev=b

Re: [R] lattice barchart using a time scale in x axis

2010-02-05 Thread Fran Velasco
Thanks a lot for your help, the examples worked fine, just have to change the colours to produce a b&w plot, and add the legend On 05/02/2010 17:11, RICHARD M. HEIBERGER wrote: Fran, The trick is to use box.width, not box.ratio. xyplot(Perc ~ as.POSIXct(hora,format="%d-%m-%Y %H:%M"), d

Re: [R] lattice barchart using a time scale in x axis

2010-02-05 Thread RICHARD M. HEIBERGER
Fran, The trick is to use box.width, not box.ratio. xyplot(Perc ~ as.POSIXct(hora,format="%d-%m-%Y %H:%M"), data=digrate, groups=Drate, ## key=leg, xlab="time of the day", horizontal=FALSE, scales=list(alternating=FALSE, tck=c(1,0), x=list(at=seq(r

Re: [R] lattice barchart using a time scale in x axis

2010-02-05 Thread Fran Velasco
Hi all, Thanks for your answers, it worked, but still can't get the time scale on the x-axis, probably has to do with the unit in the viewport or something like that. But following your recommendation I've prepared some dummy data to go with the scripts. As before we have two graphs, one that ha

Re: [R] lattice barchart using a time scale in x axis

2010-02-04 Thread RICHARD M. HEIBERGER
> SCript with xyplot: > xyplot(Perc~as.POSIXct(hora,format="%d-%m-%Y > %H:%M"),digrate,groups=digrate$Drate,key=leg,xlab="time of the day", > > scales=list(alternating=F,tck=c(1,0),x=list(at=seq(r[1],r[2],by="hour"),labels=format(seq(r[1],r[2],"hours"),format="%H:%M"))), >            panel=function

[R] lattice barchart using a time scale in x axis

2010-02-04 Thread Fran Velasco
I'm trying to produce a barchart plot with groups, in which each group is placed in a particular time scale in x-axis. If I use barchart directly it does not take the time scale. I've tried with xyplot and adding a panel.barchart, I have the bars in the right place, but not the three groups I'm

Re: [R] lattice barchart

2009-11-18 Thread Deepayan Sarkar
On Tue, Nov 17, 2009 at 3:31 PM, Wilberforce wrote: > > I have a data frame with two factors and want to create panel barcharts with > one factor defining the panels and the other the vertical categories by > which I can count the rows of data in each combination of factors. How do I > do this? >

[R] lattice barchart

2009-11-17 Thread Wilberforce
I have a data frame with two factors and want to create panel barcharts with one factor defining the panels and the other the vertical categories by which I can count the rows of data in each combination of factors. How do I do this? I have been trying to use barchart(~factor1|factor2) but it doe

Re: [R] Lattice barchart-reordered

2009-10-13 Thread Dieter Menne
Veerappa Chetty wrote: > > Hi,Can I use "reorder" function with barchart as in dotchart? Here are > some > codes which do not work for me. > .. example remove > As your example is not self-contained (it should be), I cannot show it with your data. My preferred way is to reorder outside, beca

[R] Lattice barchart-reordered

2009-10-12 Thread Veerappa Chetty
Hi,Can I use "reorder" function with barchart as in dotchart? Here are some codes which do not work for me. Thanks Chetty ___ a1c.cast$bmi.cat.reordered[a1c.cast$eth!="Other"] <-with(a1c.cast[a1c.cast$eth!="Other",],reorder(bmi.cat.ordered[a1c.cast$eth!="Other"], BP.FN.RATE

Re: [R] Lattice(barchart) related query

2009-06-03 Thread Girish A.R.
Thanks a bunch, Coltrey! That works like a charm as well! In summary, the code that solves both my queries is shown below: --- mdat <- matrix(c (-2.65,-3.7,-0.8,-1.4,-2.39,-1.12,-4.78,-4.9,-0.76,-1.56, 1.77,1.41,1.92,1.78,0.05,0.96,0.29,

Re: [R] Lattice(barchart) related query

2009-06-03 Thread Coltrey Mather
No problem. Sorry I ignored your font question, I have no personal experience, but this may help: https://stat.ethz.ch/pipermail/r-help/2009-April/196745.html On Wed, Jun 3, 2009 at 10:17, Girish A.R. wrote: > Thanks, Coltrey! Option 1 is what I was looking for. > > -Girish > > On Jun 3, 8:05 pm

Re: [R] Lattice(barchart) related query

2009-06-03 Thread Girish A.R.
Thanks, Coltrey! Option 1 is what I was looking for. -Girish On Jun 3, 8:05 pm, Coltrey Mather wrote: > barchart(mdat, >         groups=FALSE, >         layout=c(2,5), >         aspect=0.7, >         reference=FALSE, >         as.table=TRUE, >         main=list("Maintitle",cex=1), >         pane

Re: [R] Lattice(barchart) related query

2009-06-03 Thread Coltrey Mather
barchart(mdat, groups=FALSE, layout=c(2,5), aspect=0.7, reference=FALSE, as.table=TRUE, main=list("Maintitle",cex=1), panel=function(x, y, ...) { colours <- character() colours[x < 0] <- 'red' co

Re: [R] Lattice(barchart) related query

2009-06-03 Thread David Winsemius
On Jun 3, 2009, at 9:56 AM, Girish A.R. wrote: Hi, I have been recently experimenting with the lattice package, which I must admit is just great! However, I'm sort of stuck in modifying certain parameters; Would appreciate some pointers on a couple of things: 1) Is it possible to change the f

[R] Lattice(barchart) related query

2009-06-03 Thread Girish A.R.
Hi, I have been recently experimenting with the lattice package, which I must admit is just great! However, I'm sort of stuck in modifying certain parameters; Would appreciate some pointers on a couple of things: 1) Is it possible to change the font of the labels (say to computer modern) -- eith