[R] Canadian politcal party colours in ggplot2
istazahn at gmail.com
Thu Apr 4 14:10:07 CEST 2013
Yeah, I guess my blind trust in wikipedia got me in trouble this time.
The wikipedia colors are not the official colors, or maybe they just
contain errors. If you can find another website with a more
authoritative list you could adapt the technique. Or maybe wikipedia
is close enough.
On Thu, Apr 4, 2013 at 8:04 AM, John Kane <jrkrideau at inbox.com> wrote:
> Excellent. I never thought of something like that. Clearly I need to look into the XML package more closely.
> The peculiar NDP orange comes through just great though for other readers, your example seems to assign the Canadian Alliance colours to the NDP. Quelle horreur!
> John Kane
> Kingston ON Canada
>> -----Original Message-----
>> From: istazahn at gmail.com
>> Sent: Wed, 3 Apr 2013 09:43:25 -0400
>> To: jrkrideau at inbox.com
>> Subject: Re: [R] Canadian politcal party colours in ggplot2
>> Hi John,
>> How about this:
>> party.info <-
>> fed.party.info <- party.info[]
>> fed.party.colors <- fed.party.info[, 2]
>> names(fed.party.colors) <- gsub("^.*\\|", "", fed.party.info[, 4])
>> tmp <- data.frame(x=1:15,
>> z=factor(rep(c("Canada Party", "NDP", "Socialist"),
>> ggplot(tmp, aes(x=x, y=y)) +
>> geom_point(aes(color=z)) +
>> scale_color_manual(values = fed.party.colors)
>> On Wed, Apr 3, 2013 at 9:08 AM, John Kane <jrkrideau at inbox.com> wrote:
>>> A stupid question but does anyone know how to express the actual colours
>>> used by the main Canadian political parties? I want to do a couple of
>>> ggplot2 plots and have lines or rectangles that accurately reflect the
>>> party colours.
>>> I can probably play around with RColorBrewer or something to figure it
>>> out but if some some already has got them it would save me some time
>>> especially with the NDP orange.
>>> John Kane
>>> Kingston ON Canada
>>> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
>>> R-help at r-project.org mailing list
>>> PLEASE do read the posting guide
>>> and provide commented, minimal, self-contained, reproducible code.
> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
> Check it out at http://www.inbox.com/marineaquarium
More information about the R-help