[R] Colours for sunflowerplot

Nicola Van Wilgen Nicola.VanWilgen at sanparks.org
Mon Dec 12 12:09:08 CET 2011


Hi Jim,

I think this will work well for what I need it for - thanks a lot!

I would still be interested (for interest sake) if anyone knows how to
get this to work using sunflower plot.

Thanks again,

Nicola

-----Original Message-----
From: Jim Lemon [mailto:jim at bitwrit.com.au] 
Sent: 12 December 2011 11:18 AM
To: Nicola Van Wilgen
Cc: r-help at r-project.org; victoria at saeon.ac.za
Subject: Re: [R] Colours for sunflowerplot

On 12/12/2011 06:00 PM, Nicola Van Wilgen wrote:
> Dear fellow R users,
>
>
>
> I would like to draw a "sunflowerplot" because I have data (decade by
> month) that plots multiple times on the same x-y co-ordinates. Further
I
> would like to colour each of the points/sunflower leaves on the plot
> according to the group they belong to (i.e. which type of event each
> represents within that decade and month). I thought that this would be
> relatively straight forward - I have a series of x and y co-ords and a
> colour associated with each and I just use the column with the colours
> in it to colour-code the points using col = column.name when calling
the
> plot.
>
>
>
> However, the sunflower plot uses the function "xy.coords" to calculate
> the number of times that multiple points are plotted at the same
> coordinates and in so doing creates a new dataset (x.coords, y.coords
> and the number of times each is repeated) and this dataset no longer
has
> the colours associated with the individual points. The colours in a
> resultant plot merely plot in the original order.
>
>
>
> I would like to know whether there is a way of associating the correct
> colours with individual points that are now represented by the
xy.coords
> output.
>
Hi Nicola,
I couldn't figure out a way to make sunflowerplot use the original 
colors, but this might help you:

extremes.decade<-
  read.csv("extremes_decade.csv",stringsAsFactors=FALSE)
library(plotrix)
extreme.clusters<-
  cluster.overplot(extremes.decade$Decade,extremes.decade$Month,
  col=extremes.decade$Extreme)
plot(extreme.clusters,col=extreme.clusters$col)

Jim

--------------------------------------------------------------------------------
This e-mail communication and any attachments are confidential and are intended 
only for the individual(s) or entity named above and others who have been
specifically authorized to receive it. If you are not the intended recipient, 
please do not copy, use or disclose the contents of this communication to others. 
Please notify the sender that you have received this email in error by replying 
to the e-mail or by telephoning the sender. Please then delete the e-mail and 
any copies of it. This information may contain private, confidential or 
privileged material. 
Thank you. 
--------------------------------------------------------------------------------



More information about the R-help mailing list