The first ten lines of code work OK temporariy. The final line is for a second more-usual axis. But if I say line=4 to prevent its overwriting the first axis, it goes off the graph page. How do I solve that prob;em? install.packages('plotrix') library(plotrix) horAxisLims=c(0,7213) verData=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000) #not fussy horData=c(1,300,800,1200,1700,2100,2900,3400,3800,4300,4800,5200,5600,6100,6500,7000) #not at tics horTicLocs=c(1,365,809,1252,1753,2191,2922,3409,3896,4383,4819,5255,5691,6128,6564,7000) horLabels=c('1Yr','1Da','10.8Hr','7Hr','5Hr','4Hr','3Hr','2.57Hr','2.25Hr','2Hr','1.82Hr','1.67Hr','1.54Hr','1.43Hr','1.34Hr','1.25Hr') plot(horData,verData,xaxt='n',xlim=horAxisLims) axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels))) staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0)) axis(1,labels=TRUE,tick=TRUE,line=3,at=NULL) -- View this message in context: http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696.html Sent from the R help mailing list archive at Nabble.com.
> The first ten lines of code work OK temporariy. > The final line is for a second more-usual axis. > But if I say line=4 to prevent its overwriting the first axis, it goes off the graph > page. > How do I solve that prob;em?Change the plot margins before plotting using par(mar) Example: windows() #or X11() par(mar=c(6.5, 4,4,2)+0.1) plot(1:10, xlab="") axis(1, line=4) Also consider using par(mgp) to get the axis labels a bit closer to the axis, or using mtext() to place x axis labels. S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
Sorry, I'm enclosing incomplete not-runnable code. axis(1,tick=TRUE,at=horTicLocs,labels=rep("",length(horLabels)),padj=0) staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0)) nFrqTicInvls=9; frqTicLocs <- vector(length=nFrqTicInvls+1); frqLabels <- vector(length=nFrqTicInvls+1); frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl for(i in 1:(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,"S","sR",frqTicLocs[i],as.integer(4)) for(i in 1:(nFrqTicInvls+1))print(frqLabels[i]) axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep("",length(frqLabels)),padj=0) staxlab(1,at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0)) The first axis and first staxlab works. The second axis is OK below the first axis. The print(frqLabels[i]) is OK. But the second staxlab puts the frqLabels[i] on the first (upper) axis. I must have to add something to the second staxlab to select second axis? Hurr -- View this message in context: http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690803.html Sent from the R help mailing list archive at Nabble.com.