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?
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?
ii) why does the north arrow insist in not appearing?
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
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo