[R-sig-Geo] Dramatically slow plotting
Rolando Valdez
rvaldezr at gmail.com
Thu Mar 20 23:22:34 CET 2014
Hi Ben,
I tried with X11(type=“Xlib”) and I had no changes in time. Then I tried with X11(type=“cairo”) and it reduced considerably the time, however, I got a low quality map.
I think, the Quartz gives a high quality plots, that’s why it takes a lot of time.
Regards,
Rolando Valdez
El 18/03/2014, a las 09:26, Ben <galuardi at MIT.EDU> escribió:
> Hi Rolando,
>
> I don't use Macs but I do use Linux and have similar issues. I found it that the plotting device type called by default is inordinately slow at plotting spatial objects. Try opening a different type of device and run the example
>
> X11(type='Xlib')
> X11(type='cairo')
>
> also, try
>
> quartz()
>
> which is mac specific (and possibly called by default)
>
> help on X11 here:
> https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/x11.html
>
> Cheers,
> Ben
>
>
> ------ Original Message ------
> From: "Rolando Valdez" <rvaldezr at gmail.com>
> To: r-sig-geo at r-project.org
> Sent: 3/17/2014 6:23:51 PM
> Subject: [R-sig-Geo] Dramatically slow plotting
>
>> 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
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
Rolando Valdez
More information about the R-sig-Geo
mailing list