Skip to content

Help for x axis

1 message · David L Carlson

#
Try these:

aggData <- aggregate(age~smoke+gender, sampleData, function(x) c(mean=mean(x), 
	stderr=sd(x)/sqrt(length(x))))
aggData
plotInfo <- barplot(aggData$age[,1], ylim=c(0, max(rowSums(aggData$age))))
axis(1, c(0, plotInfo), c("Gender", "-", "-", "+", "+"), line=.75, 
	lwd=0, cex.axis=1.25, xpd=TRUE)
axis(1, c(0, plotInfo), c("Smoke", "-", "+", "-", "+"), line=2, 
	lwd=0, cex.axis=1.25, xpd=TRUE)
top <- aggData$age[,1]+aggData$age[,2]
bottom <- aggData$age[,1]-aggData$age[,2]
arrows(plotInfo, bottom, plotInfo, top, length=.15, angle=90, code=3)


boxplot(age~smoke+gender, sampleData, xaxt="n")
axis(1, 0:4, c("Gender", "-", "-", "+", "+"), line=.75, 
	lwd=0, cex.axis=1.25, xpd=TRUE)
axis(1, 0:4, c("Smoke", "-", "+", "-", "+"), line=2, 
	lwd=0, cex.axis=1.25, xpd=TRUE)


David

-----Original Message-----
From: Olivier [mailto:olivier.lerouzic at ymail.com] 
Sent: Monday, November 17, 2014 4:39 PM
To: David L Carlson
Subject: Re: [R] Help for x axis

Thank you very much, it is all I want to do. Is it possible with showing 
the error-bars or in a boxplot?
Best regards,

Olivier Le Rouzic
On 2014-11-17, 4:07 PM, David L Carlson wrote: