I have a data frame (freqOvertimeHourlyData) like this:
HOURS INTERVAL BARCOLOR
1 147 16-17 "green"
2 150 17-18 "green"
3 144 18-19 "blue"
4 149 19-20 "red"
5 139 20-21 "red"
6 101 21-22 "red"
Is there a way to create a barplot, using geom_bar
, with fill color according to the actual color names explicitly specified as a variable in the data set (column BARCOLOR)? My current plot is made like this:
ggplot(freqOvertimeHourlyData, aes(x = INTERVAL, y = HOURS))+
geom_histogram(stat = "identity")+
theme(legend.position = "none")