Skip to content
Prev 372403 / 398498 Next

Σχετ: Σχετ: change colour in barplot

Dear Duncan
Many thanks for this; actually the vector solution works much better.?
Best,?Maria 

    ???? 12:27 ?.?. ???????, 20 ????????? 2017, ?/? Duncan Murdoch <murdoch.duncan at gmail.com> ??????:
On 20/11/2017 7:09 AM, Maria Lathouri wrote:
The problem is that you have dat as a matrix with only one row.
barplot() applies the colours to the rows of dat; since you have only 
one row, everything ends up blue.

You can fix this by creating dat as a vector using

dat<-c(Emission_from_Land, Emission_from_Access_Road,
? ? ? ? ? ? Emissions_from_well_pad)

or by using "beside = TRUE" in the arguments to barplot.? These will 
give similar but slightly different results; I don't know which one is 
better for you, but I like the vector solution better.

Duncan Murdoch