[R] How to plot log histograms?

Guido Masarotto guido at sirio.stat.unipd.it
Fri Oct 20 15:33:27 CEST 2000


On Fri, Oct 20, 2000 at 01:42:54PM +0100, Bent Nielsen wrote:
> Q: Is there an easy way to plot log histograms?
> 
> The command "hist" draws a standard histogram with observed frequency on the
> y-axis.  I would like to be able to draw the log frequency on the y-axis,
 
  Something like:
  > h <- hist(your.data,plot=F)
  > h$counts <- log(h$counts) #assuming no counts equal to 0
  > plot(h,ylab="log(Frequency)")

> 
> - and the same question for kernel density estimates using "density".
> 

  Same theme:
  > d <- density(your.data)
  > d$y <- log(d$y)
  > plot(d,ylab="log(density)",main="")

  guido

  (ps) Q: Where do h$counts and d$y  come out? 
       A: Look to str(h) and str(d).
  
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list