rplotlevelplot

Histograms in Levelplot() when Plotting a Raster


I have a raster called r. I need to plot it using levelplot() in r. I used the following codes

library(raster)
library(rasterVis)

# Define the color ramp
colorRamp <- colorRampPalette(c("orange","pink","yellow","green","dark green", "blue","dark blue"))

# Plot the raster
levelplot(r , col.regions = colorRamp(100), main = "Predicted BD", scales = list(draw = FALSE))

These codes generate a map that has two histograms on top and right corner of it as in the following image:

enter image description here

I do not like those graphs on the top and the right corner of my map, but I do not know how to get rid of them. How can I remove them from my map?


Solution

  • Setting margin = FALSE will get rid of the maps on the margins of your levelplot.