[R] How do I show real values on a log10 histogram

John Kane jrkrideau at inbox.com
Tue Mar 26 11:48:05 CET 2013


Something like this?  It does an extra y-axis but the principle is the same for an x-axis

# Create the data to be graphed
        x<-1:10
        y1<-x
        y2<-x^2

# Set the par values
        op  <- par(las=1,xaxs="r",mai=c(1,0.75,1,1))

# Draw first plot        
        plot(x,y1,xlim=c(0,10),ylim=c(0,10), ylab="y1", las = 1)
        title(main="Multiple Y-Axes in R")
# Draw second plot
        par(new=TRUE)
        plot(x,y2,xlim=c(0,10),xaxt="n",yaxt="n",ylab="",pch=16)
        axis(4,at=c(0,20,40,60,80,100))
        text(12, 50, "y2", srt = 270, xpd = TRUE)
        par(op)  # reset par 

John Kane
Kingston ON Canada


> -----Original Message-----
> From: careyshan at gmail.com
> Sent: Tue, 26 Mar 2013 10:19:09 +0000
> To: r-help at r-project.org
> Subject: [R] How do I show real values on a log10 histogram
> 
> Hi,
> 
> I have a histogram with values logged to the base 10
> 
> hist(log10(x),breaks=60)
> 
> How do I show the log values on the x-axis and a second x-axis showing
> the
> real values?
> 
> Thanks
> 
> --
> Shane
> 
> 	[[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.

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails



More information about the R-help mailing list