[R] change colour in barplot
mlathouri at yahoo.gr
Mon Nov 20 12:38:25 CET 2017
I know that it is a very simple question but it seems that I cannot change the colour in the bars.
I have the following dataframe:
A B C D E F G 0.0.24 152460 474 5.5 612000 59061000 1540313
and here is the script:
emission<-read.csv("emission from land.csv")
#define the formulas
#combine my outputs into a new dataframe
dat<-cbind(Emission_from_Land, Emission_from_Access_Road, Emissions_from_well_pad)
#plot a barplot
barplot(dat, ylab="Kg-CO2 Eq", ylim=c(0.0e+00, 2e+10), axisnames=FALSE, col=c("blue", "red", "orange"),
main ="Well Site Construction Emissions", legend.text=c("Land", "Access", "Well"),
args.legend = list(x="bottom", horiz="TRUE", bty="n", inset=c(-0.5, -0.25)))
When I add the col= argument, the colour changes in the legend but not the actual bars in the plot. I don't know what I am doing wrong. I know that I am missing something but I cannot figure it out.
I would very much appreciate for your help.
[[alternative HTML version deleted]]
More information about the R-help