I have a code like this
# two data frames
sf = data.frame(days = c('05-06', '05,08'), Frequency = c(0, 2))
normal = data.frame(days = c('05-06', '05,07'), Frequency = c(1, 3))
# plot
ggplot() +
geom_bar(aes(y = Frequency, x = days), data = normal,
stat="identity", colour = 'black') +
geom_bar(aes(y = Frequency, x = days), data = sf,
stat="identity", colour = 'red')
I want to add legend to it with red and black color, I tried this one which is the most related solution to my question, but it just shows the legend for the first barplot. How can I have a barplot legend with black and red color?
Notice: it is not one data frame, they are two separate data frames, with different number of rows, so I can not merge them together. So I plot two bar plots. The above code fill the plots, what I want is to add a legend that shows the first bar plot is black and the second one is red.