[R] plot several histograms with same y-axes scaling using hist()

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun May 1 17:52:40 CEST 2011



On 29.04.2011 14:39, Jim Lemon wrote:
> On 04/29/2011 08:35 PM, hck wrote:
>> Dear all
>>
>> Problem: hist()-function, scale = “percent”
>>
>> I want to generate histograms for changing underlying data. In order
>> to make
>> them comparable, I want to fix the y-axis (vertical-axis) to, e.g.,
>> 0%, 10%,
>> 20%, 30% as well as to fix the spaces, too. So the y-axis in each
>> histogram
>> should be identical. Currently, I have 100 histograms and the y-axis
>> scales
>> changes in each.
>>
>> Here is my code:
>>
>> ="Hist(na.exclude("&AA3&"), breaks=50, col=""seashell3"",
>> scale=""percent"",xlim=c(-1, 1), xlab=""Bewertungsfehler"",
>> ylab=""Haeufigkeit (in %)"", main=""KBV"", border=""white"")"
>>
>> I tried the ylim=c(…), but unfortunately it does not work.
>
> Hi Hans,
> The "barp" function in plotrix can plot histograms (see the last example
> on the help page) and may be flexible enough to do what you want.#

or just use a fixed ylim?

Uwe

> Jim
>
> ______________________________________________
> 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.



More information about the R-help mailing list