I try to make a barplot with ggplot2 and am facing some issues with defining the color for NA.
ggh <- ggplot(data=dat, aes(x=var1, fill=var2))+
geom_bar(position="dodge")+
scale_fill_manual(
values=c("s"="steelblue", "i"="darkgoldenrod2", "r"="firebrick4", na.value="black"))
In my var2 I have values c("s", "i", "r", NA)
. For some reason my code above inside the scale_fill_manual
does not work for NA, even if it works fine for all the others values.
Can someone help me figure out why?
Thanks for the help
scale_fill_manual(values=c("s"="steelblue", "i"="darkgoldenrod2", "r"="firebrick4"), na.value="black")
– Tiresiasvalues
doesn't include the argna.value
so close the vector ofvalues
– Kerbela