[R] Can someone please explain why the last tick mark on this chart is not showing?

Jorgy Porgee jorgy.porgee at gmail.com
Wed Sep 16 17:13:44 CEST 2009


Hi all,

I'm trying to log chart but with natural looking tick marks. My
specifications are very specific -- it must indicate the lowest
number's tick as well as the maximum.

I've attached sample code and data for a particular  case (and there
are a few more like this) where the bottom tickmarks on the chart are
not set to where I want them to be and yet they fit in the ylim range.

Please, can anyone help? I'm tearing my hair out at this point..

Thanking you in advance,

George.

# Code below

sample<-c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 5525, 5600, 7100, 6124, 6550, 6061, 6950, 6650, 7150,
7275, 8700, 10511, 10399, 10345, 11200, 10200, 11035, 12500,
15750, 14445, 10902, 11500, 8527, 6440, 7140, 7190, 6844, 6750,
6924, 6268, 8010, 7575, 8200, 9240)

# Plotting code
# Box settings
par(bty="l",ps=7,tcl=0.2,mgp=c(0.5,0.2,0),bg="white");
# Make x axis match exactly the data
par(xaxs="i",yaxs="r");
# Margins
par(mar=c(1.2,1.8,1,1))

# Step 1: Generate logs for the data
sampleLog<-log(sample,10)
# Step 2: Determine pretty min/max for the data
purtee<-pretty(c(sample,pxTarget))
dataMin<-min(sample,na.rm=T)*0.95
dataMax<-max(purtee)
# Step 3: Create exponential series
t<-exp(seq(log(dataMin),log(dataMax),length=11))
t2<-round(t,-1)
t2[t2==0]<-1
# natural looking labels
lab<-signif(round(t,-1),2)
lab[1]<-signif(lab[1],1)
ylimits<-range(log(t2,10))
plot(sampleLog,type='l',xaxt="n",yaxt="n",ylim=ylimits,las=2,ann=FALSE)
axis(2,las=2,at=log(lab,10),labels=lab);




More information about the R-help mailing list