[R-SIG-Mac] Dramatically slow map plotting
Rolando Valdez
rvaldezr at gmail.com
Fri Mar 21 00:56:14 CET 2014
Hello,
Recently, I acquired a MacBook Pro, Core i7, 8 GB ram. I Installed the newest R version, 3.0.3 from the web page. The problem is when I’m plotting maps, because is going very, very slow, about 3 or 4 minutes just for a single map, while I’ve done this in a few seconds in Windows with Core i5 and 4 GB ram.
This is what I have:
R version 3.0.3 (2014-03-06) -- "Warm Puppy"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)
[R.app GUI 1.63 (6660) x86_64-apple-darwin10.8.0]
I found a reproducible example in web and I took time with proc.time()
ptm <- proc.time()
library(sp)
library(lattice) # required for trellis.par.set():
trellis.par.set(sp.theme()) # sets color ramp to bpy.colors()
# prepare nc sids data set:
library(maptools)
nc <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], proj4string=CRS("+proj=longlat +datum=NAD27"))
arrow = list("SpatialPolygonsRescale", layout.north.arrow(),
offset = c(-76,34), scale = 0.5, which = 2)
#scale = list("SpatialPolygonsRescale", layout.scale.bar(),
# offset = c(-77.5,34), scale = 1, fill=c("transparent","black"), which = 2)
#text1 = list("sp.text", c(-77.5,34.15), "0", which = 2)
#text2 = list("sp.text", c(-76.5,34.15), "1 degree", which = 2)
## multi-panel plot with filled polygons: North Carolina SIDS
spplot(nc, c("SID74", "SID79"), names.attr = c("1974","1979"),
colorkey=list(space="bottom"), scales = list(draw = TRUE),
main = "SIDS (sudden infant death syndrome) in North Carolina",
sp.layout = list(arrow), as.table = TRUE)
# sp.layout = list(arrow, scale, text1, text2), as.table = TRUE)
proc.time() - ptm
user system elapsed
2.408 0.064 2.616
It was quick.
Then I did a single plot with my shape:
mapa <- readShapePoly(“Entidades_2013.shp”)
ptm <- proc.time()
spplot(mapa[1]); proc.time() - ptm
user system elapsed
87.575 0.786 88.068
Why it take a lot of time? I worked with same shapes in Windows and never took that time.
Hope you can help me,
Regards,
Rolando Valdez
More information about the R-SIG-Mac
mailing list