[R] Is ther a possibility to display the log(frequency) instead of the frequency in the hist plot?
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Jan 18 10:46:22 CET 2001
Witold Eryk Wolski wrote:
>
> Uwe Ligges wrote:
>
> > Witold Eryk Wolski wrote:
> > >
> > > Is there a possibility to display the log(frequency) instead of the
> > > frequency in the hist?
> >
> > I think you want something like the following example:
> >
> > x <- runif(100) * 10
> > my.hist <- hist(x)
> > my.hist # have a look at the values!
> > my.hist$counts <- log(my.hist$counts, 10) # logarithm with base 10
> > plot(my.hist) # now plot it again with log(frequency)
> >
> > Uwe Ligges
> >
>
> Hi Uwe!
> First thanks for your answer.
> Some questions still remain to me.
> 1. How take an log if one of the my.hist$counts equals 0?
You want to use a histogram, so you have to think about what you want to
do in that case.
> 2. You code expample produces an error message which i doesnt understand.
> > plot(my.hist) # now plot it again with log(frequency)
> Error in plot.window(xlim, ylim, log, asp, ...) :
> invalid xlim
???
No, cannot reproduce it with my example!
> 3. I tried as workaround something similar.
> plot(my.hist$mids,log(my.hist$counts),type="s") And this would work quite good for
> my needs.
> But problem with log(0) = -Inf still remains.
So we have to change the mathematical axioms. ;-)
> I think I have to formulate my question more general. Why, and this is an question
> which I am asking myself since
> I am started using R becouse im using the hist plot quite often, the hist plot in
> the base package has no similar
> options like eg. the histogram plot in XMGR?
>
> THX
> Eryk
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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