In ggplot2, I am trying to make the axes have green lines.
textMessagesLine + stat_summary(fun = mean, geom = "point", aes(group = Group, color = Group, shape = Group)) + stat_summary(fun = mean, geom = "line", aes(group = Group, linetype = Group, color = Group)) + stat_summary(fun.data = mean_cl_boot, geom = "errorbar", width = 0.05, aes(color = Group)) + scale_y_continuous(limits = c(0,100)) + labs(x = "Time", y = "Mean Grammar Score", color = "Group") + theme_classic() + theme(panel.grid.major = element_line(color = "Blue", linewidth = 0.1), panel.grid.minor = element_line(color = "Red", linewidth = 0.1)) + theme(axis.line = theme_segment(color = "Green"))
I am getting Error in element_segment(color = "Green") : could not find function "element_segment"
I tried using theme(axis.line = element_segment(color = "Green"))
instead of theme(axis.line = theme_segment(color = "Green"))
but to no avail.
[Here, it's recommended to use theme_segment()
][1]
[1]: https://stackoverflow.com/questions/10861773/remove-grid-background-color-and-top-and-right-borders-from-ggplot2
but this post uses opts()
which is replaced by theme()
but doesn't accept theme_segment()
(or theme_line()
).
In my original code I had used theme_line()
, but after looking it up, I used element_line()
here theme(panel.grid.major = element_line(color = "Blue", linewidth = 0.1), panel.grid.minor = element_line(color = "Red", linewidth = 0.1))
, which worked.
Do you have any suggestions as to how to use the segment option?