color by factor using fill
# from Lubrizol NOV 2017
# by Andy L
# all lines in one histogram
ggplot(data = repairs, aes(x = ttf)) +
theme_bw() +
geom_histogram(stat = "bin", bins = 40, aes(fill = line)) +
labs(
title = "Distribution of time to failure",
x = "time to failure",
y = "# of failures" )
# facet by lines
ggplot(data = repairs, aes(x = ttf)) +
theme_bw() +
geom_histogram(stat = "bin", bins = 40, aes(fill = line)) +
facet_wrap(~ line, nrow = 2) +
labs(
title = "Distribution of time to failure",
x = "time to failure",
y = "# of failures" )