plot - R raster image distorted -
i'm trying create map includes raster , polygon shapefile. since add legend i'm working layout()
command. however, found out plotting raster overwrite layout()
recommended use image()
instead of plot()
raster ("r - plotting multiple rasters using matrix layout". works totally fine layout()
command , overlaying of polygon shapefile no problem either. but, map totally distorted, there compressions in y
, y
direction (see image). on left layers plotted proportional, on right map distorted:
here part of code:
#loading shapes , raster datasets citymap <- raster("citymap.tif") rise <- readshapespatial("rise") setwd("g:/maps") pdf(paste("map",i,".pdf", sep=""), width=16.53, height=11.69) #set layout map mat <- matrix(c(1,2), 1,2) layout(mat, c(0.75, 0.25)) par(mar=c(0.5,0.5,2.5,0.5), oma=c(0,3,1,0)) #set map extent maxxlim <- max((data$utm_x) + 800) maxylim <- max((data$utm_y) + 800) minxlim <- min((data$utm_x) - 800) minylim <- min((data$utm_y) - 800) #plot raster image(stadtkarte, xlim=c(minxlim, maxxlim), ylim=c(minylim, maxylim), maxpixels = 3000000, axes=false, col = gray.colors(10, start = 0.3, end = 0.9, gamma = 2.2, alpha = null), useraster = true, bty='n') #plot shape plot(rise, xlim=c(minxlim, maxxlim), ylim=c(minylim, maxylim), col=alpha(c("green", "yellow", "orange", "red")[rise$z_werte_21], 0.3), border="white", lwd=0.001, add=t)
i pretty new r , don't know how solve problem, when plotting raster layers not overlap properly, when imaging raster map gets distorted. there had problem before or has solution problem?
Comments
Post a Comment