My data:
df <- data.frame(sp = c(LETTERS[1:8]),
tr = c("NS", "LS", "NS", "LS", "LS", "HS", "HS", "HS"),
bv = c(14, 5, 11, 5.6, 21, 5.4, 2, 4.8),
av = c(0.0, 14, 21, 48.4, 15, 55.6, 37, 66.2))
I do the bar plot
library(reshape2)
df1 <- melt(df, id.vars = c("sp", "tr"))
ggplot(aes(sp, value, fill = variable) , data = df1) + theme_classic() +
geom_bar(aes(lty = tr), lwd = 1.2, data = df1, stat = "identity", colour = "black", width =.8) +
theme(legend.position = "bottom" ) +
scale_linetype_discrete(name = "ja")
Output
What I does not like is the legend. I'd like to have just the lines type from the second part "ja
" and remove "variable
" part. I'd like to have the white background in the legend boxes, not the grey one.