Thanks Edzer, that worked. Nothing better than receiving directions from the author.

As usual, the real "issue" was the user.
 
Best,
--
Thiago V. dos Santos
PhD student
Land and Atmospheric Science
University of Minnesota
http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm
Phone: (612) 323 9898


________________________________
 From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
To: r-sig-geo@r-project.org 
Sent: Monday, May 27, 2013 9:38 AM
Subject: Re: [R-sig-Geo] Issue when producing bubble plot (sp)




On 05/27/2013 03:06 PM, Thiago V. dos Santos wrote:
>  Dear R-siggers,
> 
> I'm trying to produce a bubble plot using the sp package. The plot is ok, but there are two issues I would like to improve. To see them, please reproduce the code below:
> 
> ----------------------------------------
> 
> require(sp)
> require(rgdal)
> 
> # Read PR shapefile
> download.file('https://dl.dropboxusercontent.com/u/27700634/PR.zip', 'PR.zip')
> unzip('PR.zip')
> pr <- readOGR('.', 'PR')
> 
> # Read plot data
> dcoef <- read.csv('https://dl.dropboxusercontent.com/u/27700634/data.csv',sep=';', header=T)
> 
> coordinates(dcoef) <- c('Longitude','Latitude')
> 
> # Coerce the polygon outlines to a SpatialLines object 
> spl <- list('sp.lines', as(pr, 'SpatialLines'))
> 
> # basic bubble plot
> bubble(dcoef, 'pvalue', main = 'P-values', key.entries = seq(0.2, 1, by=0.2), sp.layout=spl)
> ----------------------------------------
> 
> Here is the first issue: how can I "zoom out" the plot to show the entire shapefile contour, and not focus only on the dots domain?
> 

bb = bbox(pr)
bubble(dcoef, 'pvalue', main = 'P-values', key.entries = seq(0.2, 1,
by=0.2), sp.layout=spl, xlim = bb[1,], ylim = bb[2,])


> Now, going ahead with the code:
> 
> ----------------------------------------
> 
> # More sophisticated plot
> rv = list('sp.polygons', pr, fill = 'lightgrey') # 
> arrow = list('SpatialPolygonsRescale', 
>              layout.north.arrow(), 
>              offset=c(-51, -24), 
>              scale = 0.5, which = 2)
> 
> bubble(dcoef, 'pvalue',                   # data.frame and column to be plotted
>        main = 'P-values',                 # title
>        col='red',                         # color of bubbles
>        key.entries = seq(0.2, 1, by=0.2), # legend
>        scales=list(draw = TRUE),          # degrees in axes
>        sp.layout=list(rv, arrow))         # include additional items
> ----------------------------------------
> 
> 
> Here are two issues: 
> i) same as below: how can I show the entire shapefile contour, and not focus only on the dots domain?

same as above, I'd guess.

> 
> ii) why does the north arrow insist in not appearing?

remove the 'which = 2' when defining arrow -- this tells spplot to plot
the arrow in the second panel; your plot has only one.

> 
> Thanks in advance for any suggestion.
> 
> Greetings,
> --
> Thiago V. dos Santos
> PhD student
> Land and Atmospheric Science
> University of Minnesota
> http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm
> Phone: (612) 323 9898
>     [[alternative HTML version deleted]]
> 
> 
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
83 33081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
	[[alternative HTML version deleted]]

