Skip to content

Instantly share code, notes, and snippets.

@houshuang
Created June 3, 2013 17:58
Show Gist options
  • Save houshuang/5699989 to your computer and use it in GitHub Desktop.
Save houshuang/5699989 to your computer and use it in GitHub Desktop.
ggplot(db[db$gender %in% c("Male", "Female"), ],
aes(x=course, fill=gender, stat="identity")) +
geom_bar(position="fill", width = .5) +
geom_bar(data=db,mapping=aes(x="All Courses",fill=gender)) +
labs(title="Gender distribution") +
coord_flip() +
scale_x_discrete(labels = course.titles) +
scale_y_continuous(labels = percent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment