Skip to content

histogram

4 messages · Luca De Benedictis, Brian Ripley, Agustin Lobo

#
Dear friends,
I have been following the help-list in the next two months and I would
like to tell how much I admire the effort of such a great teem of R
expert. I am learning a lot. Thank you.

My problem is the following. I work with a fairly large data set (700
productive sectors, 70 countries, 25 years) and I am applying kernel
density (using MASS or sm) to sectoral exports which have markedly
skewed distributions, so I do the analysis on a log scale.
What I would like when I plot histograms or densities is to have on the
horizontal axis not the value y which is equal to log(x) but the
expression log(x) itself (i.e. log(0.3), log(1), log(34),...)

I have played a little bit with names.arg :
plot(density(log(x[,3]),width=0.4, names.arg="log(x)")

but I was not very successful. Any suggestion would be appreciated.
Thanks.

Luca
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debene.vcf
Type: text/x-vcard
Size: 321 bytes
Desc: Card for Luca De Benedictis
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020612/39ca499d/debene.vcf
#
On Wed, 12 Jun 2002, Luca De Benedictis wrote:

            
How about

x <- rlnorm(700)
den <- density(log(x))
den$x <- exp(den$x)
plot(den, log="x", title="something meaningful")

?
#
If your initial values are 1:10,
a <- paste(paste("log(",1:10,sep=""),")",sep="")

would give you a vector string a:
[1] "log(1)"  "log(2)"  "log(3)"  "log(4)"  "log(5)"  "log(6)"  "log(7)"
 [8] "log(8)"  "log(9)"  "log(10)"

You can use "a" for in the histogram in a number of ways.
Faster:
note tick labels in the x-axis. Here from 0 to 3 by 0.5:
Better:
Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es
On Wed, 12 Jun 2002, Luca De Benedictis wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
The example I sent was intended to show
how to make the tick labels with paste(),
not the distribution, of course.

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._