[R] change colour in barplot

Maria Lathouri
Mon, 20 Nov 2017 11:38:25 -0000

Dear all
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:
setwd("~/Desktop")
emission<-read.csv("emission from land.csv")
attach(emission)
#define the formulas
Emission_from_Land<-A*B*C*DEmission_from_Access_Road<-E*(F/1000000)*CEmissions_from_well<-(G/1000000)*E*C
#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.?
Many thanks,Maria
	[[alternative HTML version deleted]]