Description Usage Format Source Examples
Colours associated with New Zealand political parties in the early 21st century
1 |
A named vector of colours
https://en.wikipedia.org/wiki/Wikipedia:Index_of_New_Zealand_political_party_meta_attributes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Example use of parties_v in a colour scale for ggplot2
if(require(ggplot2) & require(scales) & require(dplyr) & require(forcats)){
polls %>%
filter(MidDate > as.Date("2014-11-20") & !is.na(VotingIntention)) %>%
filter(Party %in% c("National", "Labour", "Green", "NZ First")) %>%
mutate(Party = fct_reorder(Party, VotingIntention, .desc = TRUE),
Party = fct_drop(Party)) %>%
ggplot(aes(x = MidDate, y = VotingIntention, colour = Party, linetype = Pollster)) +
geom_line(alpha = 0.5) +
geom_point(aes(shape = Pollster)) +
geom_smooth(aes(group = Party), se = FALSE, colour = "grey15", span = .4) +
scale_colour_manual(values = parties_v) +
scale_y_continuous("Voting intention", label = percent) +
scale_x_date("") +
facet_wrap(~Party, scales = "free_y")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.