Created
December 30, 2012 01:36
-
-
Save so-c/4410445 to your computer and use it in GitHub Desktop.
2012年に読んだ本のバーチャートをggplot2で書く。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("ggplot2") | |
entries <- data.frame(label=factor(c("小説", "読書", "漫画", "新書"), | |
levels=c("小説", "読書", "漫画", "新書")), | |
num=c(69, 34, 17, 3)) | |
g <- ggplot(entries, aes(x=label, y=num, fill=label)) | |
p <- g + geom_bar() | |
p <- p + xlab("ラベル") + ylab("投稿数") + ggtitle("2012年に読んだ本") + theme(legend.position = "none") | |
plot(p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment