[R-sig-Geo] spplot : varying dots for multiple parameters

servet ahmet çizmeli sa.cizmeli at usherbrooke.ca
Fri Dec 11 17:11:50 CET 2009


Dear all,

I am new to R and sp. Thanks for your patience. I did several hours of research
in various places. This list is my last resort.

I am trying to plot on a spatial map the punctual measurements of the
data located in the file (https://opengeo.metu.edu.tr/test.csv). I'd like to do
that with the tools in the lattice package as I will add more parameters on the
same graph later. When I call spplot using the code given below, I get the
warning:

Warning messages:
1: In if (!x$aspect.fill) panel.height[[1]] <- x$aspect.ratio * panel.width[[1]]
:
  the condition has length > 1 and only the first element will be used
2: In if (layout.respect) { :
  the condition has length > 1 and only the first element will be used
3: In heights.x[pos.heights[["panel"]]] <- heights.settings[["panel"]] *  :
  number of items to replace is not a multiple of replacement length

Question 1 : I did several trials but could not eliminate this warning. Is this
serious?

Question 2 : Only the dots of the parameter "SPM" varies with its magnitude. How
to make the other parameters also have varying dot sizes?

Question 3 : I formed the code below by basing myself on an example given in the
book of Bivand et al. I then arbitrarily changed the "scale" parameter of the
scalebar so that it goes in a nice place. However, how could I now the real
length of the scale bar so that I can change the "1km" string which is false
right now.

Any ideas?
thanks a lot from advance
Servet

rm(list=ls())
library(sp)

Insitu = read.table("test.csv", skip=3,sep=",")
Header = read.table("test.csv", skip=1,sep=",",nrows=1)
names(Insitu)= as.character(as.matrix(Header))
CRS_4326 = CRS("+init=epsg:4326")

Insitu_sp <-
SpatialPointsDataFrame(cbind(Insitu[,"Boylam"],Insitu[,"Enlem"]),
data=Insitu, proj4string=CRS_4326)

idx = is.na(Insitu[,"SPM"])
ptsize = 20/(sqrt(Insitu[!idx,"SPM"])+1)

pts <- list("sp.points", Insitu_sp[!idx,"SPM"], pch = 4, col = "red",cex=ptsize)
north <- list("SpatialPolygonsRescale", layout.north.arrow(),
    offset = c(28.85, 36.735), scale = 0.02)
scale <- list("SpatialPolygonsRescale", layout.scale.bar(),
    offset = c(29, 36.735), scale = 0.1, fill = c("transparent",
        "black"))
txt1 <- list("sp.text", c(29, 36.745), "0")
txt2 <- list("sp.text", c(29.1, 36.745), "1 km")

my.layout <- list(txt1,txt2,scale,north)
spplot(Insitu_sp[!idx,c("SPM","Si","LUT","HEX")],cex=ptsize,sp.layout =
my.layout)



More information about the R-sig-Geo mailing list