[R] Colours for sunflowerplot
Jim Lemon
jim at bitwrit.com.au
Mon Dec 12 10:17:49 CET 2011
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
More information about the R-help
mailing list