generate better imges
This commit is contained in:
parent
0738f9791a
commit
35bf83e9f6
@ -96,7 +96,7 @@ color.gradient <- scales::seq_gradient_pal("yellow", "magenta", "Lab")(seq(0,1,l
|
|||||||
|
|
||||||
table(d$num.calls, d$absences)
|
table(d$num.calls, d$absences)
|
||||||
|
|
||||||
## png("questions_absence_histogram_combined.png", units="px", width=600, height=400)
|
png("questions_absence_histogram_combined.png", units="px", width=600, height=400)
|
||||||
|
|
||||||
ggplot(d) +
|
ggplot(d) +
|
||||||
aes(x=as.factor(num.calls), fill=as.factor(absences)) +
|
aes(x=as.factor(num.calls), fill=as.factor(absences)) +
|
||||||
@ -108,7 +108,7 @@ ggplot(d) +
|
|||||||
scale_fill_manual("Absences", values=color.gradient) +
|
scale_fill_manual("Absences", values=color.gradient) +
|
||||||
theme_bw()
|
theme_bw()
|
||||||
|
|
||||||
## dev.off()
|
dev.off()
|
||||||
|
|
||||||
absence.labeller <- function (df) {
|
absence.labeller <- function (df) {
|
||||||
lapply(df, function (x) { paste("Absences:", x) })
|
lapply(df, function (x) { paste("Absences:", x) })
|
||||||
@ -116,12 +116,12 @@ absence.labeller <- function (df) {
|
|||||||
|
|
||||||
## png("questions_absence_histogram_facets.png", units="px", width=600, height=400)
|
## png("questions_absence_histogram_facets.png", units="px", width=600, height=400)
|
||||||
|
|
||||||
ggplot(d) +
|
## ggplot(d) +
|
||||||
aes(x=as.factor(num.calls)) +
|
## aes(x=as.factor(num.calls)) +
|
||||||
geom_bar() +
|
## geom_bar() +
|
||||||
stat_count() +
|
## stat_count() +
|
||||||
scale_x_discrete("Number of questions answered") +
|
## scale_x_discrete("Number of questions answered") +
|
||||||
scale_y_continuous("Number of students") +
|
## scale_y_continuous("Number of students") +
|
||||||
theme_bw() +
|
## theme_bw() +
|
||||||
facet_wrap(.~absences, ncol=5, labeller="absence.labeller")
|
## facet_wrap(.~absences, ncol=5, labeller="absence.labeller")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user