Home > Software design >  Histogram in R Program
Histogram in R Program

Time:06-21

I have created a histogram to show LULC by pixel values. The code I used is:-

library(raster)
RupandehiLULC19<-raster('C:/Users/lenovo/Desktop/EM/RupandehiLULC2.tif')
plot(RupandehiLULC19)
hist(RupandehiLULC19, main="Boxplot of LULC By Pixel Value", xlab="Pixel Value", 
las=1,col=c("green"))

The map displayed is:-

enter image description here

Though the histogram is displayed it looks congested , text is overlapping (i.e. frequency overlapping with number value) & one column of pixel value higher than frequency label. How can this be fixed?

CodePudding user response:

You can try e.g. increasing the range of values in the y axis with ylim, and changing las to 3 to avoid the axis labels overlapping the axis title:

hist(RupandehiLULC19, main="Boxplot of LULC By Pixel Value", xlab="Pixel Value", las=3, col=c("green"), ylim = c(0, 80000))

  • Related