[R] Combined grouped and stacked bargraph

2012-05-01 Thread Nicola Van Wilgen
Dear R-list

 

I am having some trouble drawing a bar-graph with two groups, both of
which are stacked.

 

Here are my data in the dput format:

 

cs.not.log.bp <- (

structure(c(168, 69, 16, 69, 41, 6, 148, 6, 5, 4, 7, 4, 4, 2, 7, 2, 4,
2, 4, 2, 1, 0, 2, 0), .Dim = c(4L, 6L), .Dimnames = list(

c("IUCN.Terrestrial", "IUCN.Marine", "National.CS.Terrestrial", 

"National.CS.Marine"), c("NE", "LC", "NT", "VU", "EN", "CR"

))) )

 

The database format is shown below, where columns represent conservation
status and the rows are two classification methods each split into
marine and terrestrial:

 

 NE  LC NT VU EN CR

IUCN.Terrestrial168  41  5  4  4  1

IUCN.Marine  69   6  4  2  2  0

National.CS.Terrestrial  16 148  7  7  4  2

National.CS.Marine   69   6  4  2  2  0

 

I would like to plot the conservation status according to two
classifications (i.e. my groups - IUCN status and national status), and
for each of those groups I would like data for the marine and
terrestrial species to be stacked. 

 

I have tried the following code (where cs.not.log.bp is my data), but it
does not work:

 

barplot(cs.not.log.bp[c(1:2),], xlab = "Conservation status", ylab =
"Number of species", col = c("grey90","grey80"), ylim = c(0,250), space
= 2)

 

barplot(cs.not.log.bp[c(3:4),], col = c("grey60","grey30"), beside =
T,add = T,names.arg = NA)

 

legend("topright",c("IUCN Terrestrial","IUCN Marine","National CS
Terrestrial","National CS Marine"),  col =
c("grey90","grey80","grey60","grey30"), pch = 15)

 

What happens is that some of the data in the second group stacks onto
the first group and then the remainder forms a second group. I would
like only "like" data (i.e. from the same database row) to stack within
a group.

 

There was one other similar post on the R-list
(http://r.789695.n4.nabble.com/barplot-question-td3670861.html ) where
the user had the same problem as I did, but it does not seem that this
was resolved.

 

Please let me know if you have any suggestions.

 

Thanks and best wishes,

 

Nicola

 


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. 

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] FW: Combined grouped and stacked bargraph

2012-04-25 Thread Nicola Van Wilgen
Dear John and R-list

Thank you for your comment. Here are my data in the dput format:

cs.not.log.bp <- (
structure(c(168, 69, 16, 69, 41, 6, 148, 6, 5, 4, 7, 4, 4, 2, 
7, 2, 4, 2, 4, 2, 1, 0, 2, 0), .Dim = c(4L, 6L), .Dimnames = list(
c("IUCN.Terrestrial", "IUCN.Marine", "National.CS.Terrestrial", 
"National.CS.Marine"), c("NE", "LC", "NT", "VU", "EN", "CR"
))) )

The database format is shown below, where columns represent conservation
status and the rows are two classification methods each split into
marine and terrestrial:

 NE  LC NT VU EN CR
IUCN.Terrestrial168  41  5  4  4  1
IUCN.Marine  69   6  4  2  2  0
National.CS.Terrestrial  16 148  7  7  4  2
National.CS.Marine   69   6  4  2  2  0

I would like to plot the conservation status according to two
classifications (i.e. my groups - IUCN status and national status), and
for each of those groups I would like data for the marine and
terrestrial species to be stacked. 

I have tried the following code (where cs.not.log.bp is my data), but it
does not work:

barplot(cs.not.log.bp[c(1:2),], xlab = "Conservation status", ylab =
"Number of species", col = c("grey90","grey80"), ylim = c(0,250), space
= 2)

barplot(cs.not.log.bp[c(3:4),], col = c("grey60","grey30"), beside =
T,add = T,names.arg = NA)

legend("topright",c("IUCN Terrestrial","IUCN Marine","National CS
Terrestrial","National CS Marine"),  col =
c("grey90","grey80","grey60","grey30"), pch = 15)

What happens is that some of the data in the second group stacks onto
the first group and then the remainder forms a second group. I would
like only "like" data (i.e. from the same database row) to stack within
a group.

There was one other similar post on the R-list
(http://r.789695.n4.nabble.com/barplot-question-td3670861.html ) where
the user had the same problem as I did, but it does not seem that this
was resolved.

Please let me know if you have any suggestions.

Thanks and best wishes,

Nicola

-Original Message-
From: John Kane [mailto:jrkrid...@inbox.com] 
Sent: 25 April 2012 02:58 PM
To: Nicola Van Wilgen; r-help@r-project.org
Subject: RE: [R] FW: Combined grouped and stacked bargraph

Hi Nicola,

You have provided the code and data as requested the data is in a very
unfriendly format.

If you would  supply the data in an easily useable format so that the
readers here can work with it it would help.

Since it looks like you have a small data set the easiest thing is to
use dput()  [see ?dput for information] and then just paste the output
into your email.  I expect you would get faster and better answers.


John Kane
Kingston ON Canada


> -Original Message-
> From: nicola.vanwil...@sanparks.org
> Sent: Wed, 25 Apr 2012 14:42:49 +0200
> To: r-help@r-project.org
> Subject: [R] FW: Combined grouped and stacked bargraph
> 
> Dear R list,
> 
> It appears that my request from yesterday got a bit garbled. I have
> tried to rephrase and retype it - please let me know if you can help
me
> - I am having some trouble drawing a bar-graph with two groups, both
of
> which are stacked.
> 
> I would like to plot the conservation status according to two
> classifications (i.e. my groups - IUCN status and national status),
and
> for each of those groups I would like data for the marine and
> terrestrial species to be stacked. My data look like this (where the
> names for the columns are conservation status': NE, LC, NT, VU, EN and
> CR; and the matrix name is cs.not.log.bp):
> 
> IUCN.Terrestrial168  41  5  4  4  1
> 
> IUCN.Marine  69   6  4  2  2  0
> 
> National.CS.Terrestrial  16 148  7  7  4  2
> 
> National.CS.Marine   69   6  4  2  2  0
> 
> I have tried the following code, but it does not work:
> 
> barplot(cs.not.log.bp[c(1:2),], xlab = "Conservation status", ylab =
> "Number of species", col = c("grey90","grey80"),names = cs.names, ylim
=
> c(0,250), space = 2)
> 
> barplot(cs.not.log.bp[c(3:4),], col = c("grey60","grey30"), beside =
> T,add = T,names.arg = NA)
> 
> legend("topright",c("IUCN Terrestrial","IUCN Marine","National CS
> Terrestrial","National CS Marine"),  col =
> c("grey90","grey80","grey60","grey30"), pch = 15)
> 
> What happens is that some of the data in the second group stacks onto
> the first group and then the remainder forms a second group. I would
> like only "like" data (i.e. from the same database row) to stack
within

[R] FW: Combined grouped and stacked bargraph

2012-04-25 Thread Nicola Van Wilgen
Dear R list,

It appears that my request from yesterday got a bit garbled. I have
tried to rephrase and retype it - please let me know if you can help me
- I am having some trouble drawing a bar-graph with two groups, both of
which are stacked.

I would like to plot the conservation status according to two
classifications (i.e. my groups - IUCN status and national status), and
for each of those groups I would like data for the marine and
terrestrial species to be stacked. My data look like this (where the
names for the columns are conservation status': NE, LC, NT, VU, EN and
CR; and the matrix name is cs.not.log.bp):

IUCN.Terrestrial168  41  5  4  4  1

IUCN.Marine  69   6  4  2  2  0

National.CS.Terrestrial  16 148  7  7  4  2

National.CS.Marine   69   6  4  2  2  0

I have tried the following code, but it does not work:

barplot(cs.not.log.bp[c(1:2),], xlab = "Conservation status", ylab =
"Number of species", col = c("grey90","grey80"),names = cs.names, ylim =
c(0,250), space = 2)

barplot(cs.not.log.bp[c(3:4),], col = c("grey60","grey30"), beside =
T,add = T,names.arg = NA)

legend("topright",c("IUCN Terrestrial","IUCN Marine","National CS
Terrestrial","National CS Marine"),  col =
c("grey90","grey80","grey60","grey30"), pch = 15)

What happens is that some of the data in the second group stacks onto
the first group and then the remainder forms a second group. I would
like only "like" data (i.e. from the same database row) to stack within
a group.

There was one other similar post on the R-list
(http://r.789695.n4.nabble.com/barplot-question-td3670861.html ) where
the user had the same problem as I did, but it does not seem that this
was resolved.

Please let me know if you have any suggestions.

Thanks and best wishes,

Nicola

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Nicola Van Wilgen
Sent: 24 April 2012 01:12 PM
To: r-help@r-project.org
Subject: [R] Combined grouped and stacked bargraph

Dear R list,

 

I am having some trouble drawing a bar-graph with two groups, both of
which are stacked.

 

A sample of my data (IUCN and national conservation status for marine
and terrestrial species) look like this:

Status

IUCN Terrestrial

IUCN Marine

National CS Terrestrial

National CS Marine

NE

168

69

16

69

LC

41

6

148

6

NT

5

4

7

4

VU

4

2

7

2

EN

4

2

4

2

CR

1

0

2

0

 

I would like to plot the conservation status for two groups (IUCN status
and national status), and for each of those groups I would like data for
the marine and terrestrial species to be stacked. I needed to transpose
the data to plot correctly, so my data in the code below look like this
(where the names for data in the columns are NE, LC, NT, VU, EN and CR;
and the matrix name is cs.not.log.bp):

 

IUCN.Terrestrial168  41  5  4  4  1

IUCN.Marine  69   6  4  2  2  0

National.CS.Terrestrial  16 148  7  7  4  2

National.CS.Marine   69   6  4  2  2  0

 

I have tried the following code, but it does not work:

 

barplot(cs.not.log.bp[c(1:2),], xlab = "Conservation status", ylab =
"Number of species", col = c("grey90","grey80"),

  names = cs.names, ylim = c(0,250), space = 2)

barplot(cs.not.log.bp[c(3:4),], col = c("grey60","grey30"), beside =
T,add = T,names.arg = NA)

legend("topright",c("IUCN Terrestrial","IUCN Marine","National CS
Terrestrial","National CS Marine"),

  col = c("grey90","grey80","grey60","grey30"), pch = 15)

 

What happens is that some of the data in the second group stacks onto
the first group and then the remainder forms a second group. I would
like only "like" data to stack within a group.

 

There was one other similar post on the R-list
(http://r.789695.n4.nabble.com/barplot-question-td3670861.html ) where
the user had the same problem as I did, but it does not seem that this
was resolved.

 

Please let me know if you have any suggestions.

 

Thanks and best wishes,

 

Nicola



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

[R] Combined grouped and stacked bargraph

2012-04-24 Thread Nicola Van Wilgen
Dear R list,

 

I am having some trouble drawing a bar-graph with two groups, both of
which are stacked.

 

A sample of my data (IUCN and national conservation status for marine
and terrestrial species) look like this:

Status

IUCN Terrestrial

IUCN Marine

National CS Terrestrial

National CS Marine

NE

168

69

16

69

LC

41

6

148

6

NT

5

4

7

4

VU

4

2

7

2

EN

4

2

4

2

CR

1

0

2

0

 

I would like to plot the conservation status for two groups (IUCN status
and national status), and for each of those groups I would like data for
the marine and terrestrial species to be stacked. I needed to transpose
the data to plot correctly, so my data in the code below look like this
(where the names for data in the columns are NE, LC, NT, VU, EN and CR;
and the matrix name is cs.not.log.bp):

 

IUCN.Terrestrial168  41  5  4  4  1

IUCN.Marine  69   6  4  2  2  0

National.CS.Terrestrial  16 148  7  7  4  2

National.CS.Marine   69   6  4  2  2  0

 

I have tried the following code, but it does not work:

 

barplot(cs.not.log.bp[c(1:2),], xlab = "Conservation status", ylab =
"Number of species", col = c("grey90","grey80"),

  names = cs.names, ylim = c(0,250), space = 2)

barplot(cs.not.log.bp[c(3:4),], col = c("grey60","grey30"), beside =
T,add = T,names.arg = NA)

legend("topright",c("IUCN Terrestrial","IUCN Marine","National CS
Terrestrial","National CS Marine"),

  col = c("grey90","grey80","grey60","grey30"), pch = 15)

 

What happens is that some of the data in the second group stacks onto
the first group and then the remainder forms a second group. I would
like only "like" data to stack within a group.

 

There was one other similar post on the R-list
(http://r.789695.n4.nabble.com/barplot-question-td3670861.html ) where
the user had the same problem as I did, but it does not seem that this
was resolved.

 

Please let me know if you have any suggestions.

 

Thanks and best wishes,

 

Nicola


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. 

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Colours for sunflowerplot

2011-12-12 Thread Nicola Van Wilgen

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:j...@bitwrit.com.au] 
Sent: 12 December 2011 11:18 AM
To: Nicola Van Wilgen
Cc: r-help@r-project.org; victo...@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. 


__
R-help@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] Colours for sunflowerplot

2011-12-12 Thread Nicola Van Wilgen
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.

 

If you are interested in this example, an example of the code that I
have been using and the input data used can be found at the end of this
message.

 

Many thanks in advance for your input!

 

Best wishes,

 

Nicola

 

Code: 
For sunflowerplot

par(las = 1)

sunflowerplot(extremes.decade$Decade, extremes.decade$Month, col =
extremes.decade$Extreme, 

  cex = 1.2, xlab = "Decade", ylab = "Month", axes = F , pch = 16,
seg.col = extremes.decade$Extreme, 

  size = 0.2, seg.lwd =2)  

axis(side = 1, at = c(6:11), labels =
c("","1960s","1970s","1980s","1990s","2000s"), tick = TRUE, line = NA)

axis(side = 2, at = c(0:12), labels =
c("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","
Dec"), tick = TRUE, line = NA)

legend(7, 12.5, legend = c("Grp1"," Grp2"," Grp3"," Grp4"," Grp5","
Grp6"," Grp7"," Grp8"), 

  col =
c("blue","brown","orange","green","red","lightblue","purple","pink"),
pch = 19, bty = "n")  

 

For comparison of where colours should lie - normal plot:

#add random number to make all points different so that they dont
overplot

a <- runif(109,1,1.001)

extremes.decade$Year.a <- a*extremes.decade$Year

 

plot(extremes.decade$Year.a, extremes.decade$Month, col =
extremes.decade$Extreme, 

  cex = 1.2, xlab = "Decade", ylab = "Month", yaxt ="n" , pch = 16)  

#axis(side = 1, at = c(6:11), labels =
c("","1960s","1970s","1980s","1990s","2000s"), tick = TRUE, line = NA)

axis(side = 2, at = c(0:12), labels =
c("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","
Dec"), tick = TRUE, line = NA)

legend(1950, 12.5, legend = c("Grp1"," Grp2"," Grp3"," Grp4"," Grp5","
Grp6"," Grp7"," Grp8"),

  col =
c("blue","brown","orange","green","red","lightblue","purple","pink"),
pch = 19, bty = "n")  

 

 

 

Data: 

Decade

Year

Month

Extreme

7

1968

1

brown

7

1966

2

green

7

1966

2

lightblue

7

1968

2

green

7

1963

3

lightblue

7

1966

4

green

7

1961

5

lightblue

7

1967

5

blue

7

1964

6

blue

7

1965

6

green

7

1968

6

blue

7

1968

6

lightblue

7

1965

7

orange

7

1963

9

red

7

1964

9

lightblue

7

1968

9

blue

7

1961

10

green

7

1966

10

brown

7

1965

12

green

8

1973

1

brown

8

1976

1

red

8

1977

1

brown

8

1977

2

blue

8

1977

2

orange

8

1974

3

blue

8

1970

4

brown

8

1974

4

brown

8

1975

4

brown

8

1975

5

green

8

1973

6

red

8

1979

7

blue

8

1979

8

blue

8

1974

9

lightblue

8

1979

9

green

8

1974

10

brown

8

1975

10

green

8

1976

10

blue

8

1976

11

green

8

1970

12

lightblue

8

1975

12

lightblue

9

1980

1

pink

9

1982

1

pink

9

1980

2

pink

9

1986

2

pink

9

1981

3

green

9

1982

5

green

9

1987

5

red

9

1985

6

pink

9

1980

7

red

9

1983

7

blue

9

1980

8

pink

9

1981

8

lightblue

9

1985

8

red

9

1981

9

green

9

1982

9

pink

9

1985

10

orange

9

1987

10

brown

9

1983

11

pink

10

1990

1

red

10

1999

1

brown

10

1997

2

brown

10

1999

2

brown

10

1999

3

orange

10

1991

4

brown

10

1991

4

red

10

1997

4

lightblue

10

1997

6

blue

10

1997

6

lightblue

10

1994

7

green

10

1996

7

lightblue

10

1999

7

orange

10

1993

9

blue

10

1994

10

pink

10

1997

10

red

10

1994

11

brown

10

1996

11

blue

10

1996

11

lightblue

10

1993

12

blue

10

1997

12

purple

11

2004

1

orange

11

2001

2

brown

11

2006

2

orange

11

2006

2

red

11

2000

3

lightblue

11

2000

3

orange

11

2002

3

red

11

2004

3

purple

11

2003

4

orange

11

2004

4

purple

11

2001

5

purple

11

2003

5

purple

11

2002

7

purple

11

2005

7

red

11

2002

8

blue

11

2002

8

orange

11

2002

8

purple

11

2006

8

blue

11

2001

10

orange

11

2002

10

brown

11

2002

10

purple

11

2005

10

red

11

2002

11

purp

[R] Colours for sunflowerplot

2011-12-11 Thread Nicola Van Wilgen
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.

 

If you are interested in this example, an example of the code that I
have been using and the input data used can be found at the end of this
message.

 

Many thanks in advance for your input!

 

Best wishes,

 

Nicola

 

Code: 
For sunflowerplot

par(las = 1)

sunflowerplot(extremes.decade$Decade, extremes.decade$Month, col =
extremes.decade$Extreme, 

  cex = 1.2, xlab = "Decade", ylab = "Month", axes = F , pch = 16,
seg.col = extremes.decade$Extreme, 

  size = 0.2, seg.lwd =2)  

axis(side = 1, at = c(6:11), labels =
c("","1960s","1970s","1980s","1990s","2000s"), tick = TRUE, line = NA)

axis(side = 2, at = c(0:12), labels =
c("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","
Dec"), tick = TRUE, line = NA)

legend(7, 12.5, legend = c("Grp1"," Grp2"," Grp3"," Grp4"," Grp5","
Grp6"," Grp7"," Grp8"), 

  col =
c("blue","brown","orange","green","red","lightblue","purple","pink"),
pch = 19, bty = "n")  

 

For comparison of where colours should lie - normal plot:

#add random number to make all points different so that they dont
overplot

a <- runif(109,1,1.001)

extremes.decade$Year.a <- a*extremes.decade$Year

 

plot(extremes.decade$Year.a, extremes.decade$Month, col =
extremes.decade$Extreme, 

  cex = 1.2, xlab = "Decade", ylab = "Month", yaxt ="n" , pch = 16)  

#axis(side = 1, at = c(6:11), labels =
c("","1960s","1970s","1980s","1990s","2000s"), tick = TRUE, line = NA)

axis(side = 2, at = c(0:12), labels =
c("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","
Dec"), tick = TRUE, line = NA)

legend(1950, 12.5, legend = c("Grp1"," Grp2"," Grp3"," Grp4"," Grp5","
Grp6"," Grp7"," Grp8"),

  col =
c("blue","brown","orange","green","red","lightblue","purple","pink"),
pch = 19, bty = "n")  

 

 

 

Data: 

Decade

Year

Month

Extreme

7

1968

1

brown

7

1966

2

green

7

1966

2

lightblue

7

1968

2

green

7

1963

3

lightblue

7

1966

4

green

7

1961

5

lightblue

7

1967

5

blue

7

1964

6

blue

7

1965

6

green

7

1968

6

blue

7

1968

6

lightblue

7

1965

7

orange

7

1963

9

red

7

1964

9

lightblue

7

1968

9

blue

7

1961

10

green

7

1966

10

brown

7

1965

12

green

8

1973

1

brown

8

1976

1

red

8

1977

1

brown

8

1977

2

blue

8

1977

2

orange

8

1974

3

blue

8

1970

4

brown

8

1974

4

brown

8

1975

4

brown

8

1975

5

green

8

1973

6

red

8

1979

7

blue

8

1979

8

blue

8

1974

9

lightblue

8

1979

9

green

8

1974

10

brown

8

1975

10

green

8

1976

10

blue

8

1976

11

green

8

1970

12

lightblue

8

1975

12

lightblue

9

1980

1

pink

9

1982

1

pink

9

1980

2

pink

9

1986

2

pink

9

1981

3

green

9

1982

5

green

9

1987

5

red

9

1985

6

pink

9

1980

7

red

9

1983

7

blue

9

1980

8

pink

9

1981

8

lightblue

9

1985

8

red

9

1981

9

green

9

1982

9

pink

9

1985

10

orange

9

1987

10

brown

9

1983

11

pink

10

1990

1

red

10

1999

1

brown

10

1997

2

brown

10

1999

2

brown

10

1999

3

orange

10

1991

4

brown

10

1991

4

red

10

1997

4

lightblue

10

1997

6

blue

10

1997

6

lightblue

10

1994

7

green

10

1996

7

lightblue

10

1999

7

orange

10

1993

9

blue

10

1994

10

pink

10

1997

10

red

10

1994

11

brown

10

1996

11

blue

10

1996

11

lightblue

10

1993

12

blue

10

1997

12

purple

11

2004

1

orange

11

2001

2

brown

11

2006

2

orange

11

2006

2

red

11

2000

3

lightblue

11

2000

3

orange

11

2002

3

red

11

2004

3

purple

11

2003

4

orange

11

2004

4

purple

11

2001

5

purple

11

2003

5

purple

11

2002

7

purple

11

2005

7

red

11

2002

8

blue

11

2002

8

orange

11

2002

8

purple

11

2006

8

blue

11

2001

10

orange

11

2002

10

brown

11

2002

10

purple

11

2005

10

red

11

2002

11

purp