Chuck White wrote:
> Here's a piece of code used to plot some locations on a map.
> 
> from rpy2.robjects import r,RDataFrame,globalEnv
> r.library('maps')
> self.store_info = r['read.delim']('file.dlm', sep='|', header=True)
> r.png(file='locations.png', width=1500, height=840, bg='transparent')
> r.map('state')
> r.points(r['$'](self.store_info,'LONGITUDE'), 
> r['$'](self.store_info,'LATITUDE'), pch=19, col='blue', cex=0.8)
> r['dev.off']()
> 
> Input file:
> LOC_ID|LATITUDE|LONGITUDE|ACCURACY
> 123|44.7294508|-93.2176135|8
> 456|45.4878370|-122.7877570|8
> 
> I would also like to show us capitals on this map.
> map.cities(us.cities, capital=2)

That might be more an R question for the authors of the map package.

The doc for that R package says something along the lines of:

map("usa")
data("us.cities")
map.cities(us.cities, capital = 2, cex = 0.5)

Translating to rpy2 is rather straightforward:

rdata = r['data']
plotmap = r['map']
plotcities = r['map.cities']

rdata('us.cities')
us_cities = globalEnv['us.cities')

plotmap("usa")
plotcities(us_cities)



L.


> How do I specify that?
> 
> Thanks.
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize  
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to