[R] Titles - main and subtitle won't plot with errbar

David Winsemius dwinsemius at comcast.net
Thu Jan 10 22:29:19 CET 2013


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




More information about the R-help mailing list