My data has values which are all the same so they are coming up as just a line in a box plot. This, however, means that I can't tell the difference between groups as the fill doesn't show up. How can I change the outlines of the boxplot to be a specific colour.
Note: I do not want all the outline colours to be the same colour, as in the next line of code:
library(dplyr)
library(ggplot2)
diamonds %>%
filter(clarity %in% c("I1","SI2")) %>%
ggplot(aes(x= color, y= price, fill = clarity))+
geom_boxplot(colour = "blue")+
scale_fill_manual(name= "Clarity", values = c("grey40", "lightskyblue"))+
facet_wrap(~cut)
Instead, I would like all the plots for I1 (filled with grey40) to be outlined in black while the plots for SI2 (filled with lightskyblue) to be outlined in blue.
The following don't seem to work
geom_boxplot(colour = c("black","blue"))+
OR
scale_color_identity(c("black", "blue"))+
OR
scale_color_manual(values = c("black", "blue"))+
colour = clarity
toaes()
and usescale_color_manual(values = c("black", "blue"))
. – Andrey Kolyadincolour = "blue"
, because that would override the aes mapping. In addition, you probably want to name the color scale Clarity, too, because otherwise you get two legends. – lukeA