I'm plotting a map of hydropower as a function of the distance to the turbine and distance to the uptake. However, when plotting I got an ugly blank space on the sides of my contour plot. I already tried the xlim = c(0,2500) but it did not work. Here you have the code:
# read data
data <- read.csv("ArchivoPotencia.csv", header = TRUE)
# make d into a SpatialPointsDataFrame object
library(sp)
coords <- data[, c("DTurbinas", "DIntake")]
s <- SpatialPointsDataFrame(coords = coords, data = data)
# interpolate with a thin plate spline
# (or another interpolation method: kriging, inverse distance weighting).
library(raster)
library(fields)
tps <- Tps(coordinates(s), as.vector(data$Potencia))
p <- raster(s)
p <- interpolate(p, tps)
# plot raster, points, and contour lines
plot(p, xlab= "Distance to Turbine", ylab = "Distance to Intake", cex=1.3, cex.lab = 1.3, cex.axis = 1.3,
legend.width=1, legend.args=list(text='HP (KW)',side=3, line=1, cex=1.0), xlim = c(0,2500))
plot(s, add=T, cex=1.5, cex.lab = 1.3, cex.axis = 1.3)
contour(p, add=T, labcex = 0.8, lwd = 1.5)
Could anyone help me to remove the space on the plot?