I have re-labeled tick marks on the x axis. The problem is that by using axes=FALSE, the axes disappears and when they are called back using axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom left corner of the graph. I would also like to have the 3rd and 4th axes in there as well, all meeting in their respective corners. par(mfrow=c(1,2)) gut<-c("Full", "Empty", "Full", "Empty") par(family="serif", cex=1.2, lab=c(length(gut),4,4)) boxplot(Xc~Trt,data=error,ylab="Reactance (Ohms)",xlab="Stomach Fullness", ylab="Reactance (Ohms)", axes=FALSE,ylim=c(50,200)) axis(side=1, at=c(1,2,3,4), labels=gut) axis(side=2) text(1.5,115, "Mid BIA") text(3.5,160, "Whole BIA") points(1,135, pch=2) points(2,135, pch=2) points(3,135, pch=17) points(4,135, pch=17) Thanks ahead of time. Keith -- Keith Cox, Ph.D. Alaska NOAA Fisheries, National Marine Fisheries Service P.O. Box 464 Sitka, Alaska, 99835 907 752-0563 marlinkcox@gmail.com [[alternative HTML version deleted]]
Look at the box function, or use xaxt='n' and/or yaxt='n' rather than axes=FALSE. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Marlin Keith Cox > Sent: Wednesday, July 15, 2009 2:44 PM > To: r-help at r-project.org > Subject: [R] Axes origins and labeling > > I have re-labeled tick marks on the x axis. The problem is that by > using > axes=FALSE, the axes disappears and when they are called back using > axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom > left > corner of the graph. I would also like to have the 3rd and 4th axes in > there as well, all meeting in their respective corners. > > par(mfrow=c(1,2)) > gut<-c("Full", "Empty", "Full", "Empty") > par(family="serif", cex=1.2, lab=c(length(gut),4,4)) > boxplot(Xc~Trt,data=error,ylab="Reactance (Ohms)",xlab="Stomach > Fullness", > ylab="Reactance (Ohms)", axes=FALSE,ylim=c(50,200)) > axis(side=1, at=c(1,2,3,4), labels=gut) > axis(side=2) > text(1.5,115, "Mid BIA") > text(3.5,160, "Whole BIA") > points(1,135, pch=2) > points(2,135, pch=2) > points(3,135, pch=17) > points(4,135, pch=17) > > Thanks ahead of time. > > Keith > > -- > Keith Cox, Ph.D. > Alaska NOAA Fisheries, National Marine Fisheries Service > P.O. Box 464 > Sitka, Alaska, 99835 > > 907 752-0563 > marlinkcox at gmail.com > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
Since you;re already specifying the axis tick locations for the x-axis any ylim for y, one way of dealing with it is to give the axes an extra tick at each end: Instead of axis(side=1, at=c(1,2,3,4), labels=gut) use axis(side=1, at=0:5, labels=gut) Similarly for axis(2), use axis(2, at=seq(0,250,50))>>> Marlin Keith Cox <marlinkcox at gmail.com> 07/15/09 9:44 PM >>>I have re-labeled tick marks on the x axis. The problem is that by using axes=FALSE, the axes disappears and when they are called back using axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom left corner of the graph. I would also like to have the 3rd and 4th axes in there as well, all meeting in their respective corners. par(mfrow=c(1,2)) gut<-c("Full", "Empty", "Full", "Empty") par(family="serif", cex=1.2, lab=c(length(gut),4,4)) boxplot(Xc~Trt,data=error,ylab="Reactance (Ohms)",xlab="Stomach Fullness", ylab="Reactance (Ohms)", axes=FALSE,ylim=c(50,200)) axis(side=1, at=c(1,2,3,4), labels=gut) axis(side=2) text(1.5,115, "Mid BIA") text(3.5,160, "Whole BIA") points(1,135, pch=2) points(2,135, pch=2) points(3,135, pch=17) points(4,135, pch=17) Thanks ahead of time. Keith -- Keith Cox, Ph.D. Alaska NOAA Fisheries, National Marine Fisheries Service P.O. Box 464 Sitka, Alaska, 99835 907 752-0563 marlinkcox at gmail.com [[alternative HTML version deleted]] ______________________________________________ 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. ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
Marlin Keith Cox wrote:> I have re-labeled tick marks on the x axis. The problem is that by using > axes=FALSE, the axes disappears and when they are called back using > axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom left > corner of the graph. I would also like to have the 3rd and 4th axes in > there as well, all meeting in their respective corners. > > par(mfrow=c(1,2)) > gut<-c("Full", "Empty", "Full", "Empty") > par(family="serif", cex=1.2, lab=c(length(gut),4,4)) > boxplot(Xc~Trt,data=error,ylab="Reactance (Ohms)",xlab="Stomach Fullness", > ylab="Reactance (Ohms)", axes=FALSE,ylim=c(50,200)) > axis(side=1, at=c(1,2,3,4), labels=gut) > axis(side=2) > text(1.5,115, "Mid BIA") > text(3.5,160, "Whole BIA") > points(1,135, pch=2) > points(2,135, pch=2) > points(3,135, pch=17) > points(4,135, pch=17) > >Hi Keith, Try fullaxis in the plotrix package. Jim