Context: I have two variables under emotion_dict that I am graphing in the same line graph.
Problem: However when I change the linetype in geom_line, it changes the appearance of both variables.
Question: Does anyone know how to alter the code below to keep the line types separate and display a key? I have done this before only with the ggline function, but that is not appropriate here.
See attached file and code below for more context:
posneg_plot2 <- d_posneg %>%
ggplot(mapping = aes(x=year, y=rel_freq, group=emotion_dict, colour=emotion_dict)) +
geom_line(alpha = 1, size=0.7, linetype=2, colour="black") +
theme_light() +
labs(x="Year", y="Positive and Negative Sentiment (%)") +
scale_x_continuous(breaks=seq(1970,2017,2)) +
theme(axis.text.x=element_text(angle=45, hjust=1)) +
scale_color_hue(labels = c("Negative Sentiment", "Positive Sentiment")) +
labs(colour = "LIWC Dictionaries") + theme(legend.position = "bottom") +
theme(text=element_text(family="Times New Roman", size=17))
#stat_cor(, method = "pearson", p.accuracy = 0.001, r.accuracy = 00.01, size = 4.5, colour = "black")
EDIT: Answer below and now attempting to change the labels within the group accordingly: