[R] Methods for showing statistics over space

Greg Snow Greg.Snow at imail.org
Mon Oct 27 17:49:51 CET 2008


Here are a few ideas.  The symbols function has a few different symbols that it can add to a plot (circles as you mentioned), one of my favorites is the thermometers, like a barplot for each county, but with a surrounding rectangle for reference so they are easier to compare while not being lined up.  The my.symbols function in the TeachingDemos package allows for more symbol options, including symbols you design yourself that can depend on data.  If you want a barplot (or other standard plot) within each county, the subplot function in the TeachingDemos package has an example of adding a barplot to each region (state) of a map, this can include axes, and the same scale to make the comparisons easier.

Another option to show spatial trends is to follow this example:

library(BSDA)
library(TeachingDemos)
library(sp)
library(maptools)

tmp2 <- rank( -Birth[-9,3] )

par(mfcol=c(5,2), mar=c(0,0,0,0))

for( i in seq(5,50,5) ){
        plot(state.vbm, axes=FALSE,
                col= ifelse( tmp2 <= i,
                        ifelse( tmp2 <= i-5, 'grey80', 'grey30'),
                        'white')
                )
}

This produces several maps (10 in this case) that are to be read down the 1st column, then the 2nd column.  Each map shows the next 5 states starting with the highest birthrate states moving down.  You can see a general progression from southwest to northeast.  Maybe you can do something similar with your data.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Werner Wernersen
> Sent: Saturday, October 25, 2008 6:05 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Methods for showing statistics over space
>
> Hi,
>
> I have a question which is a little off-topic but then again, it should
> stay in the boundaries of what can be done with available R functions.
>
> Has anyone pointers to tutorials or the like where one can get
> inspiration on how to visualize some "spatial" statistics?
> I want to analyze different statistics of 60 counties in a country. I
> have a shape file for those counties thus I can produce a map. But what
> are good ways to make statistics, e.g. price levels, clear and so that
> the viewer also can make good relative comparisons of counties lying
> far apart? It should enable a clear, quick assessment of the spatial
> dispersion of the measure. One further restriction is, that the outcome
> has to be black-and-white printable.
>
> The options I have found considered so far are:
> - different gray scale colorings of the countries: very crude and gray
> scale might be also difficult in printing
> - small bar plots within each county: difficult to compare for counties
> far apart or one has to consider an exact scale
> - bubbles with differing sizes: not very intuitive
>
> If anybody has a pointer from the top of his head, that would be
> wonderful!
>
> Thanks a million and have a good weekend,
>   Werner
>
>
>
>
>
> ______________________________________________
> 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.



More information about the R-help mailing list