This must have annoyed someone in the past so excuse me if this is a duplicate and I will remove it. Slashes across legends when using geom_bar
can be annoying. e.g.:
x <- c("a","b")
y <- c(1,2)
df <- as.data.frame(cbind(x,y))
a <- ggplot(df,aes(x=x,y=y,fill=x))
a + geom_bar(colour="black") + scale_fill_manual(values=c("white", "black"))
When I use coloured bars I use this work around, plotting bars without colours first e.g.
a + geom_bar() + geom_bar(colour="black",show_guide=FALSE) +
scale_fill_manual(values=c("white", "black"))
However when the fill is white this leaves an unsatisfying empty white box in the legend without a border. e.g.
I have fixed this in the past manually using graphics software but now I think this must be of use to enough people to ask a question here. Can we make ggplot
plot the legend with the black outline only but without the slash?