0

I have a raster that includes more than 120 million pixel values and it has values of 0,1,10,11. I would like to create a barplot to show their frequencies;

barplot(diff_raster)

gives me this;

barplot

But, I would like Y-axis to show the percentage of those pixels' values, not the amount. How can I make this? or Can you give me any other suggestions to do that?

0

The barplot() function dose not generate a histogram, but a barplot.

For generate a histogram with the stard functions of R you must use the hist() function :

hist(raster)

You can also use the density() function for generate a density curve :

plot(density(raster))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.