[R] Canadian politcal party colours in ggplot2
jrkrideau at inbox.com
Thu Apr 4 14:25:48 CEST 2013
No wiki was right: That is, the NDP party code #F4A460 is correct.
I have not looked at the ggplot code that closely yet but is there a chance that scale_color_manual(values = fed.party.colors) is cycling through the vector?
At the moment my second shot at the graph has dropped the orignal colours and looks like it's graphing Conservative, 'some funny yellow party", Conservative. or Blue, Yellow, Blue for the uninitiated.
I've noticed that occasionally RStudio does strange things on my machine and I need to start a new session or switch to gedit to check things.
I have to run now but I'll try this again later and see what happenss.
In any case you've given me the colours which is what I had hoped for.
Kingston ON Canada
> -----Original Message-----
> From: istazahn at gmail.com
> Sent: Thu, 4 Apr 2013 08:10:07 -0400
> To: jrkrideau at inbox.com
> Subject: Re: [R] Canadian politcal party colours in ggplot2
> Hey John,
> 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
>>>> used by the main Canadian political parties? I want to do a couple
>>>> 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
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails
More information about the R-help