I am trying to adapt this code which makes the legend text italics. For my specific case I am trying to figure out how I could only italicize for example the first 2 values. So in this example, "six" and "eight".
Does anybody have a solution?
library(tidyverse)
mtcars %>%
ggplot(aes(x = wt, y = mpg, color = factor(cyl))) +
geom_line() +
scale_color_manual(labels = c("four", "six", "eight"), values = c("red", "yellow", "blue")) +
theme(legend.text = element_text(size = 10, face = "italic"))