[R] Nightingale’s Rose chart-any suggestion?

John Kane jrkrideau at inbox.com
Fri Nov 30 20:17:20 CET 2012


I think this does it. 

  require(reshape2)
  
  df1  <-  melt(DF, id="month")
  
  ggplot(df1, aes(x = month, y = value, fill = variable)) +
    theme_bw() +
    geom_bar(stat = "identity") +
    coord_polar()

John Kane
Kingston ON Canada


> -----Original Message-----
> From: henry.helsinki at gmail.com
> Sent: Fri, 30 Nov 2012 14:56:51 +0100
> To: djmuser at gmail.com, r-help at r-project.org
> Subject: Re: [R] Nightingale’s Rose chart-any suggestion?
> 
> Dear Dennis,
> 
> Many thanks!
> Yes, ggplot2 could be used to illustrate a simple rose chart (category +
> one type variable)
> If I have a data frame like this:
> DF <- data.frame(month = factor(month.abb, levels = month.abb),
>                    freq1 = rpois(12, 80),freq2=rpois(12,
> 80),freq3=rpois(12, 80))
> 
> Do you have any idea how to plot the other 2 variables freq2 and freq3 by
> R?
> Nightingale?s Rose chart actually represent 3 variables here:
> blue is disease, red is wounds, and black is uncategorized.
> I checked plotrix; however, it seems it could not fulfill my purpose too.
> Actually, what I am looking for is how to render a heatmap (not a bar
> chart) in a polar coordinate system.
> Thanks again.
> 
> Best,
> Henry
> 
> 
> 
> On Fri, Nov 30, 2012 at 2:37 PM, Dennis Murphy <djmuser at gmail.com> wrote:
> 
>> A simple version of what can be done in ggplot2 is illustrated in the
>> following toy example:
>> 
>> DF <- data.frame(month = factor(month.abb, levels = month.abb),
>>                    freq = rpois(12, 80))
>> ggplot(DF, aes(x = month, y = freq)) +
>>      theme_bw() +
>>      geom_bar(stat = "identity", fill = "pink2") +
>>      coord_polar()
>> 
>> Another option might be to use the plotrix package and to look into
>> the radial.plot function, but I don't know offhand if it will produce
>> rose diagrams without some effort. In ggplot2, a rose diagram is a bar
>> chart rendered in a polar coordinate system, consistent with
>> Wilkinson's grammar of graphics (whence the gg in ggplot2).
>> 
>> Dennis
>> 
>> On Fri, Nov 30, 2012 at 4:24 AM, Henry Smith <henry.helsinki at gmail.com>
>> wrote:
>>> Hello, Everyone.
>>> 
>>> Does anyone know how to create a Nightingale?s Rose chart by using R?
>>> Hopefully, the graph could be displayed like this:
>>> http://mbostock.github.com/protovis/ex/crimea-rose.html
>>> Thanks a lot.
>>> 
>>> Kind regards,
>>> Henry
>>> 
>>>         [[alternative HTML version deleted]]
>>> 
>>> 
>>> ______________________________________________
>>> 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.
>>> 
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!




More information about the R-help mailing list