Skip to content

Instantly share code, notes, and snippets.

@willemt
Created January 8, 2014 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willemt/8314095 to your computer and use it in GitHub Desktop.
Save willemt/8314095 to your computer and use it in GitHub Desktop.
This is the R script I used to make http://www.willemthiart.com/2014/01/maori-bird-names.html
library(reshape)
library(ggplot2)
library(scales)
library(cairoDevice)
data <- read.csv("birds.csv", head=TRUE, sep=",")
Cairo_png("Birds.png", width=10, height=7)
ggplot(data, aes(x=Letter,y=Frequency,fill=Frequency)) +
geom_bar(stat="identity") +
scale_fill_continuous(guide = "colorbar", low = "#a32020", high = "#ffb600", name = "Starting letter") +
ggtitle("New Zealand Birds:\nFrequency of starting letters of Maori bird names") +
theme(
plot.title = element_text(lineheight=1, face="bold", hjust=0, family = "Arial"),
axis.text.x = element_text(family = "Arial", angle=0),
axis.text.y = element_text(family = "Arial"),
axis.title.x = element_text(family = "Arial", angle=0),
axis.title.y = element_text(family = "Arial"),
axis.line=theme_blank(),
panel.background=theme_blank(),
panel.grid=theme_blank(),
legend.position="none",
plot.background=theme_blank()
)
#coord_flip()
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment