Reputation: 381
I have a function that return a plot:
NDVI_Result = function(x,y){
output = raster::overlay(raster::raster(base::normalizePath(x)),
raster::raster(base::normalizePath(y)), fun = NDVI)
graphics::par(bg=NA,mar=c(0,0,0,0),oma=c(0,0,0,0))
raster::plot(output,axes=FALSE,box=TRUE,legend=FALSE, frame=FALSE)
After exporting this as png, I get this result:
How can I remove the right margin of the result to be able to work with the image which then contains only the box?
Upvotes: 2
Views: 1216
Reputation: 47071
You can use image
instead of plot
library(raster)
r <- raster(system.file("external/test.grd", package="raster"))
par(bg=NA,mar=c(0,0,0,0),oma=c(0,0,0,0))
image(r, axes=FALSE)
Upvotes: 2