Created
September 26, 2012 21:58
-
-
Save wch/3790888 to your computer and use it in GitHub Desktop.
Map alignment test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(gcookbook) | |
| library(ggplot2) | |
| # Take a slice where z is equal to the minimum value of z | |
| islice <- subset(isabel, z == min(z)) | |
| # Just the hurricane data | |
| ggplot(islice, aes(x=x, y=y, fill=speed)) + geom_raster(alpha=.5) + | |
| scale_fill_continuous(na.value=NA) | |
| # Get USA map data | |
| usa <- map_data("usa") | |
| # Map outline with hurricane data | |
| ggplot(islice, aes(x=x, y=y)) + | |
| geom_raster(aes(fill=speed), alpha=.5) + | |
| scale_fill_continuous(na.value=NA) + | |
| geom_path(aes(x=long, y=lat, group=group), data=usa) + | |
| coord_cartesian(xlim = range(islice$x), ylim = range(islice$y)) | |
Author
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For information about the data structures, you can do the following: