# Re: [R] Way to rotate a histogram?

From: Patrizio Frederic <frederic.patrizio_at_gmail.com>
Date: Tue, 17 Mar 2009 17:29:40 +0100

Jason,
be carefully to the order of intensities (counts or densities):

x=rnorm(1000)
par(mfrow=c(2,2))
h=hist(x,breaks=bk<-c(-5,-3,-2,-1,-.5,0,1,3,5)) barplot(rev(h\$intensities),rev(bk[2:9]-bk[1:8]),space=0,horiz=T) # compare to axis(2)
barplot(h\$intensities,bk[2:9]-bk[1:8],space=0,horiz=T) axis(2)

Patrizio

2009/3/17 David Winsemius <dwinsemius_at_comcast.net>:
> I believe that hist will return a vector that could be passed to barplot:
>
>  h.islands <- hist(islands)
>
>> barplot(h.islands\$intensities, horiz=TRUE)  # or
>> barplot(h.islands\$counts, horiz=TRUE)
>
> David Winsemius
>
> On Mar 17, 2009, at 11:38 AM, Jason Rupert wrote:
>
>>
>>
>> Here is what I have so far:
>>>
>>> test_data<-rnorm(100)
>>> par(mfrow=c(1,3)) # 3 rows by 1 columns layout of plots
>>> hist(test_data)
>>> boxplot(test_data)
>>> qqnorm(test_data)
>>
>> I noticed that I can rotate a boxplot via "horizontal", but apparently
>> "hist" does not have that functionality.
>>
>> I tried stacking the plots vertically:
>> test_data<-rnorm(100)
>> par(mfrow=c(3,1)) # 3 rows by 1 columns layout of plots
>> hist(test_data)
>> boxplot(test_data, horizontal=TRUE)
>> qqnorm(test_data)
>>
>> However, I would have to rotate the QQnorm plot, which would be pretty
>> confusing and I think non-standard.
>>
>> Thank you again for any feedback and insight regarding trying to reproduce
>> the JMP figure shown at:
>> http://n2.nabble.com/Can-R-produce-this-plot--td2489288.html
>>
>> --- On Tue, 3/17/09, Jason Rupert <jasonkrupert_at_yahoo.com> wrote:
>>
>>> From: Jason Rupert <jasonkrupert_at_yahoo.com>
>>> Subject: Re: [R] R package to automatically produce combination plot?
>>> To: R-help_at_r-project.org
>>> Date: Tuesday, March 17, 2009, 9:39 AM
>>> I guess no reply means there is not an existing package to
>>> produce the plot?
>>>
>>> I will post the results of my script to hopefully help
>>> others who are trying to formulate the same plot.
>>>
>>> Thanks again.
>>>
>>>
>>> --- On Mon, 3/16/09, Jason Rupert
>>> <jasonkrupert_at_yahoo.com> wrote:
>>>
>>>> From: Jason Rupert <jasonkrupert_at_yahoo.com>
>>>> Subject: [R] R package to automatically produce
>>>
>>> combination plot?
>>>>
>>>> To: R-help_at_r-project.org
>>>> Date: Monday, March 16, 2009, 8:14 PM
>>>> By any chance is there an R package that automatically
>>>> produces the plot shown at the following link:
>>>>
>>> http://n2.nabble.com/Can-R-produce-this-plot--td2489288.html
>>>>
>>>> That is an R package to produce on plot that has the
>>>> following:
>>>> (a) a vertically oriented histogram,
>>>> (b) associated barplot, and
>>>> (c) quantile-quantile plot (Q-Q Plot).
>>>>
>>>> This is based on a class lecture from University of
>>>> Pennsylvania:
>>>> stat.wharton.upenn.edu/~mcjon/stat-431/lecture-02.pdf
>>>>
>>>> I am pretty confident I can put one together, but just
>>>> wanted to check that there does not already exist an R
>>>> package to output such a plot.
>>>>
>>>> Thanks again.
>>>>
>>>> ______________________________________________
>>>> 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.
>>>
>>> ______________________________________________
>>> 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.
>>
>> ______________________________________________
>> 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.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> 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.
>

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. Received on Tue 17 Mar 2009 - 15:33:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 17 Mar 2009 - 18:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.