Skip to content

Commit

Permalink
Plot gender ratio or responses
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbarton committed Feb 28, 2012
1 parent 9f39100 commit 5e84154
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 2012/lib/survey.r
@@ -1,5 +1,7 @@
survey.2012 <- function(){
survey('data/survey.csv')
s <- survey('data/survey.csv')
names(s)[3] <- 'gender'
s
}

survey.2008 <- function(){
Expand Down
20 changes: 20 additions & 0 deletions 2012/plot/demographics/gender.r
@@ -0,0 +1,20 @@
#!/usr/bin/env Rscript

library(ggplot2)

source('lib/survey.r')
source('lib/colors.r')
source('lib/generate_plot_file.r')

p <- ggplot(
subset(survey.2012(),gender == "Male" | gender == "Female"),
aes(x = gender,fill=gender))

p <- p + stat_bin()
p <- p + theme_bw()
p <- p + scale_x_discrete("Gender")
p <- p + scale_y_continuous("Total responses")
p <- p + scale_fill_manual("Gender",(values = colors()))
p <- p + opts(legend.position = "none")

generate_plot_file(p,'gender.png')

0 comments on commit 5e84154

Please sign in to comment.