r - ggplot2 of categorical data - grayscale/BW theme for enhanced readability -
i trying plot line graph group in r
using ggplot2
follows. intended grayscale print.
library(ggplot2) # summarise data mry <- do.call(rbind, by(movies, round(movies$rating), function(df) { nums <- tapply(df$length, df$year, length) data.frame(rating=round(df$rating[1]), year = as.numeric(names(nums)), number=as.vector(nums)) })) p <- ggplot(mry, aes(x=year, y=number, colour=factor(rating))) p + geom_line() + scale_color_grey() + theme_bw()
however clarity lacking in resulting plot there 10 groups involved. how adjust colors/pch/line style in ggplot2 better readability in such case large number of groups involved?
i'd inclined use facets, this:
ggplot(mry, aes(x=year, y=number))+ geom_line() + scale_color_grey() + theme_bw() + facet_grid(rating~.)
obviously better in portrait mode, @ minuscule scale can tell ratings of 1,2,3,9, , 10 extremely rare, , common ratings 6 , 7 (at least recently). more can plotting on top of each other.
Comments
Post a Comment