[R] Bubble Plot Over a Map

Olivier ETERRADOSSI olivier.eterradossi at ema.fr
Thu May 7 16:44:31 CEST 2009


Hi Rodrigo,
did you consider having a look at package "ggplot2" (thanks to Hadley
Wickham).
I guess you'll find something very close to your need (functions ggplot,
geom_point,...)
Hope this helps. regards. Olivier


Rodrigo Aluizio wrote:
> 
> Hi everybody,
> 
> Well here is another doubt! I’m elaborating some maps, and I pretend to
> plot
> over it the abundance of species. I could do that using points(), but I’d
> like to use bubble() from sp package.
> 
> When trying to use bubble() I face the fallowing issue: When I call the
> bubble function it overwrite everything I previously plotted. It doesn’t
> happen with points (obviously), only with bubble(). I tried to specify
> panel.smooth as panel function to bubble, I tried to use add=T as
> argument,
> but it didn’t accept such thing.
> 
> The only thing that I thought right now, so I still have to try, is saving
> the bubble() as an object and try to manipulate its properties over my
> map.
> 
> I already searched the list posts but wasn’t able to find a similar doubt
> with its possible solutions.
> 
>  
> 
> Bellow is the map code using points, I’m trying to substitute the points()
> functions with one bubble() function.
> 
>  
> 
> for (i in 1:length(colnames(Spp10ml))) {
> 
> png(paste(colnames(Spp10ml),'.png',sep='')[i],width=5.2,height=3.6,pointsize
> =5,units='in',bg=NA,restoreConsole=T,res=1200)
> 
> par(mar=c(5,0,0,0))
> 
> map('worldHires','brazil',ylim=c(-5.15,-4.55),xlim=c(-37,-36.1),type='n')
> 
> rect(-37.1,-5.25,-36,-4.9,density=NULL,angle=45,col='#dbf4ff',border=F)
> 
> plot(Batimetria,ylab='',xlab='',border=F,col=Cor$Cor,add=T)
> 
> plot(Municipios,ylab='',xlab='',col=rgb(245,232,140,max=255,alpha=255),add=T
> ,lwd=0.2)
> 
> axis(1,xaxp=c(-37,-36.1,5),cex.axis=1.5)
> 
> axis(2,yaxp=c(-5.15,-4.55,5),cex.axis=1.5)
> 
> text(Prof$Long,Prof$Lat,rownames(Prof),col='black',cex=1.2,srt=-24,family='A
> R',font=2)
> 
> text(c(-36.96,-36.96,-36.865,-36.54,-36.37,-36.2),c(-4.96,-5.05,-5.11,-5.14,
> -5.14,-5.14),c('Areia
> 
> Branca','Serra
> 
> do Mel','Porto do
> Mangue','Macau','Guamaré','Galinhos'),col='Black',cex=1.3,font=2)
> 
> rect(-36.20,-4.56,-36.155,-4.565,density=NULL,angle=45,col='black',border='b
> lack',lwd=0.1)
> 
> rect(-36.155,-4.56,-36.111,-4.565,density=NULL,angle=45,col='white',border='
> black',lwd=0.1)
> 
> shadowtext(c(-36.20,-36.155,-36.111,-36.215),c(-4.573,-4.573,-4.573,-4.562),
> c('0','5','10','km'),col='white',cex=1)
> 
> Norte(-36.155,-4.60,0.02)
> 
> box(which='plot',lty='solid')
> 
> points(Pontos$long[Spp10ml[,i]>0 &
> Spp10ml[,i]<=50],Pontos$lat[Spp10ml[,i]>0
> & Spp10ml[,i]<=50],pch=21,bg=rgb(70,70,70,max=255,alpha=255),col=
> 'black',cex=1.5)
> 
> points(Pontos$long[Spp10ml[,i]>=51 &
> Spp10ml[,i]<=200],Pontos$lat[Spp10ml[,i]>=51 &
> Spp10ml[,i]<=200],pch=23,bg='yellow',col='black',cex=1.5)
> 
> points(Pontos$long[Spp10ml[,i]>=201 &
> Spp10ml[,i]<=400],Pontos$lat[Spp10ml[,i]>=201 &
> Spp10ml[,i]<=400],pch=22,bg='orange',col='black',cex=1.5)
> 
> points(Pontos$long[Spp10ml[,i]>=401],Pontos$lat[Spp10ml[,i]>=401],pch=24,bg=
> 'red',col='black',cex=1.5)
> 
> dev.off()}
> 
>  
> 
> Thanks in advance.
> 
>  
> 
> -------------------------------------------------------------
> 
> MSc.  <mailto:r.aluizio at gmail.com> Rodrigo Aluizio
> 
> Centro de Estudos do Mar/UFPR
> Laboratório de Micropaleontologia
> Avenida Beira Mar s/n - CEP 83255-000
> Pontal do Paraná - PR - Brasil
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/Bubble-Plot-Over-a-Map-tp23426635p23428390.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list