[R] labels in hist and ranges of an axis
Peter Ehlers
ehlers at ucalgary.ca
Tue May 15 18:34:41 CEST 2012
I'm a bit late to this party, but why not just plot with labels=FALSE
and add the labels with text(x,y,labels,cex)?
The values of x are given by the h$mids in the
h <- hist() object and the values of y are essentially h$counts
(add a bit to move the labels up). Might need to set ylim to
accommodate tall bars.
Peter Ehlers
On 2012-05-14 04:32, Gerrit Eichner wrote:
> Carol,
>
> it is not clear to me which function histogram() you use (package lattice,
> package histogram ...?), but -- if it is not a lattice function -- a quick
> hack _might_ be to use
>
>> par( cex = 2)
>
> or whatever magnification you wish followed by a reduction of cex.axis,
> cex.labels etc. according to your needs.
>
> If you used plot.histogram() take a look at its code by
>
>> graphics:::plot.histogram
>
> and you will see (at the end of the body of the function) that there is no
> "direct" way (i.e., through arguments of the function) of changing
> anything regarding the "data labels" except the one way mentioned above or
> writing your own function plot.histogram().
>
> Regards -- Gerrit
>
> On Mon, 14 May 2012, carol white wrote:
>
>> cex.axis changes the size of the axis label. I want to change the size
>> of data labels that are displayed at the top of the bars in the
>> histogram. What we obtain by histogram(...,labels=T)
>
>
>
> ________________________________
> From: Gerrit Eichner<Gerrit.Eichner at math.uni-giessen.de>
> To: carol white<wht_crl at yahoo.com>
> Cc: "r-help at stat.math.ethz.ch"<r-help at stat.math.ethz.ch>
> Sent: Monday, May 14, 2012 11:31 AM
> Subject: Re: [R] labels in hist and ranges of an axis
>
> Hi, Carol!
>
>> How is it possible to change the character size of labels in a histogram (labels parameter in hist)?
> See
>
> ?par
>
> -> cex.axis
>
>
>> How is it possible to display the ranges of an axis in 3 significant digits?
> See
>
> ?axis
>
> and its argument "at" together with
>
> ?signif
>
>
> Hth -- Gerrit
>
> ---------------------------------------------------------------------
> Dr. Gerrit Eichner Mathematical Institute, Room 212
> gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen
> Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
> Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner
> ---------------------------------------------------------------------=
More information about the R-help
mailing list