I have made a facet_grid in ggplot, like so:
ggplot(DATASET, aes((jitter(WordCount)),Retweet, group=1))+
geom_point(aes(alpha=1/150))+
facet_grid(Dictionary ~ ., margins = TRUE, scales = "free")+
labs(x = "Word Count", y = "Retweet Count", title = "A")+
theme_bw()+
theme(legend.position = "none")
How do I make each graph use points of a different colour?
For reference, here is the structure of my dataframe:
data.frame': 939006 obs. of 4 variables:
$ Retweet : num 1388 762 748 436 342 ...
$ id : int 1 2 3 4 5 6 7 8 9 10 ...
$ Dictionary: Factor w/ 3 levels "Emotional","Moral",..: 1 1 1 1 1 1 1 1 1 1 ...
$ WordCount : num 1 1 2 2 1 1 3 1 2 1 ...
As answered in the comments, assign a variable to the color aesthetic.
ggplot(DATASET, aes(WordCount), etweet, group = 1, color = Dictonary)) +
geom_jitter(aes(alpha = 1/150)) +
facet_grid(Dictionary ~ ., margins = TRUE, scales = "free") +
labs(x = "Word Count", y = "Retweet Count", title = "A") +
theme_bw() +
theme(legend.position = "none")