Hi David, Sorry, forgot to define pxTarget. It can be anything you choose so say pxTarget<-10000. I've also renamed "sample" to "sampleData". The following cut and paste should work: The last tick mark (5000) is not showing for some reason... :-/
Regards, George sampleData<-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) pxTarget<-10000 # 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(sampleData,10) # Step 2: Determine pretty min/max for the data purtee<-pretty(c(sampleData,pxTarget)) dataMin<-min(sampleData,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); On Wed, Sep 16, 2009 at 5:20 PM, David Winsemius <dwinsem...@comcast.net> wrote: > > On Sep 16, 2009, at 11:13 AM, Jorgy Porgee wrote: > >> 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)) > > Error in pretty(c(sample, pxTarget)) : object 'pxTarget' not found > ...which then creates a cascade of errors > >> 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); >> >> ______________________________________________ >> R-help@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, MD > Heritage Laboratories > West Hartford, CT > > ______________________________________________ R-help@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.