I have a raster file
and I want to plot as a histogram ,i did it using hist() as shown below. but i would like to plot using ggplot2 which plot it in a better way for publication.
conne <- file("C:\\fined.bin","rb")
r = raster(y)
hist(r, breaks=30, main="SMD_2010",
xlab="Pearson correlation", ylab="Frequency", xlim=c(-1,1))
I tried this:
qplot(rating, data=r, geom="histogram")
Error:
ggplot2 doesn't know how to deal with data of class RasterLayer
I need to plot something like:
As a fast solution You can use the result of
histPS : Maybe you need to use
scale_x_discreteto get better axis lookEDIT to add gradient fill