[R-sig-Geo] Spacial plotting of appt

A. John Woodill johnwoodill at gmail.com
Thu Jan 22 19:01:30 CET 2015


Greetings r-sig-geo!

I have a large dataset that contains multiple observations for various fips
codes located in the central portion of the United States.  Within this
data set, I have merged lat/long coordinates to zip codes and have plotted
the results of average precipitation (appt) on a map using ggplot2.  I have
been playing with various ways of plotting to provide the most visually
appealing method for displaying the data in the most telling way.  However,
I'm not sure if I'm using the correct methods and am looking for assistance
in other ways to plot the data.  In particular, I'm looking for a gradient
effect to show where the highest levels of precipitation were.  I
appreciate any help and direction you can provide.

Here is what I'm trying to achieve (although I know it's a raster object) :
http://nrelscience.org/2013/05/30/this-is-how-i-did-it-mapping-in-r-with-ggplot2/

This is a small subset of my dataset and I'm posting a link because the
dput is too large.

Data set : https://www.dropbox.com/s/0evuvrlm49ab9up/PRISM_1895_db.csv?dl=0

Code :

PRISM_1895_db <- read.csv("/.../PRISM_1895_db.csv")

regions<- c("north dakota","south
dakota","nebraska","kansas","oklahoma","texas","minnesota","iowa","missouri","arkansas",
"illinois", "indiana", "wisconsin")

# Using geom_plot

ggplot() +
    geom_polygon(data=subset(map_data("state"), region %in% regions),
aes(x=long, y=lat, group=group)) +
    geom_point(data = PRISM_1895_db, aes(x = longitude, y = latitude, color
= APPT), alpha = .5, size = 5) +
    geom_polygon(data=subset(map_data("state"), region %in% regions),
aes(x=long, y=lat, group=group), color="white", fill=NA)

# Using stat_summary2d for tiles

ggplot() +
  geom_polygon(data=subset(map_data("state"), region %in% regions),
aes(x=long, y=lat, group=group)) +
  stat_summary2d(data=PRISM_1895_db, aes(x = longitude, y = latitude, z =
APPT)) +
  geom_polygon(data=subset(map_data("state"), region %in% regions),
aes(x=long, y=lat, group=group), color="white", fill=NA)

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list