Hi, I'm struggling with errbar graphics. I'm trying to plot an x-y graph with correct labelling, however can't seem to get main and sub to show on my graph. They do work when I use title(main="," etc...., but this will make it look at lot messier,I'll have to blank out ylab=" " , and I need to try and get the titles to update automatically according to my excel column headings and paste function. Example code.... require(Hmisc) data1<-array(sample(1:100,35),dim=c(5,7)) data1[,1]<-1:5 sd=apply(data1[,2:7],1,sd) mean=rowMeans(data1[,2:7]) #the base plot works errbar(x=data1[,1],y=mean,yplus=mean+sd,yminus=mean-sd) #titles are shown correctly using plot plot(x=data1[,1],y=mean,ylab="value",xlab="time",main="Title",sub="subtitle") #the ylab and xlab update correctly, however main and sub don't? errbar(x=data1[,1],y=mean,yplus=mean+sd,yminus=mean-sd,ylab="value",xlab="time",main="Title",sub="subtitle") (my original is a lot more complicated as I'm reading from excel, and have managed to plot SD and mean for my dataset, but for some reason the main and sub commands aren't working in errbar!) Thanks, Laura -- View this message in context: http://r.789695.n4.nabble.com/Titles-main-and-subtitle-won-t-plot-with-errbar-tp4655149.html Sent from the R help mailing list archive at Nabble.com.
David L Carlson
2013-Jan-10 19:08 UTC
[R] Titles - main and subtitle won't plot with errbar
You should contact the maintainer of package Hmisc: Maintainer: Charles Dupont <charles.dupont at vanderbilt.edu> As you note, it would not be difficult to use the titles() function to get what you want or a plot command to set up but not plot data followed by the errbar() with add=TRUE. ---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of masepot > Sent: Thursday, January 10, 2013 8:54 AM > To: r-help at r-project.org > Subject: [R] Titles - main and subtitle won't plot with errbar > > Hi, I'm struggling with errbar graphics. > > I'm trying to plot an x-y graph with correct labelling, however can't > seem > to get main and sub to show on my graph. > > They do work when I use title(main="," etc...., but this will make it > look > at lot messier,I'll have to blank out ylab=" " , and I need to try and > get > the titles to update automatically according to my excel column > headings and > paste function. > > Example code.... > > require(Hmisc) > data1<-array(sample(1:100,35),dim=c(5,7)) > data1[,1]<-1:5 > sd=apply(data1[,2:7],1,sd) > mean=rowMeans(data1[,2:7]) > #the base plot works > errbar(x=data1[,1],y=mean,yplus=mean+sd,yminus=mean-sd) > #titles are shown correctly using plot > plot(x=data1[,1],y=mean,ylab="value",xlab="time",main="Title",sub="subt > itle") > #the ylab and xlab update correctly, however main and sub don't? > errbar(x=data1[,1],y=mean,yplus=mean+sd,yminus=mean- > sd,ylab="value",xlab="time",main="Title",sub="subtitle") > > (my original is a lot more complicated as I'm reading from excel, and > have > managed to plot SD and mean for my dataset, but for some reason the > main and > sub commands aren't working in errbar!) > > Thanks, > > Laura > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Titles- > main-and-subtitle-won-t-plot-with-errbar-tp4655149.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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.
David Winsemius
2013-Jan-10 21:29 UTC
[R] Titles - main and subtitle won't plot with errbar
On Jan 10, 2013, at 6:54 AM, masepot wrote:> Hi, I'm struggling with errbar graphics. > > I'm trying to plot an x-y graph with correct labelling, however can't seem > to get main and sub to show on my graph.If you are like me you are perhaps being surprised by the fact that the "subtitle" s not appearing just below the "title" but rather below the "xlab". If you are also like me it will take you some time to learn that the 'xlab' and the 'ylab' have nothing to do with "labels". -- David.> > They do work when I use title(main="," etc...., but this will make it look > at lot messier,I'll have to blank out ylab=" " , and I need to try and get > the titles to update automatically according to my excel column headings and > paste function. > > Example code.... > > require(Hmisc) > data1<-array(sample(1:100,35),dim=c(5,7)) > data1[,1]<-1:5 > sd=apply(data1[,2:7],1,sd) > mean=rowMeans(data1[,2:7]) > #the base plot works > errbar(x=data1[,1],y=mean,yplus=mean+sd,yminus=mean-sd) > #titles are shown correctly using plot > plot(x=data1[,1],y=mean,ylab="value",xlab="time",main="Title",sub="subtitle") > #the ylab and xlab update correctly, however main and sub don't? > errbar(x=data1[,1],y=mean,yplus=mean+sd,yminus=mean-sd,ylab="value",xlab="time",main="Title",sub="subtitle") > > (my original is a lot more complicated as I'm reading from excel, and have > managed to plot SD and mean for my dataset, but for some reason the main and > sub commands aren't working in errbar!) > > Thanks, > > Laura > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Titles-main-and-subtitle-won-t-plot-with-errbar-tp4655149.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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.David Winsemius Alameda, CA, USA