Description Arguments Details Examples
Map projections.
projection |
projection to use, see |
... |
other arguments passed on to |
orientation |
projection orientation, which defaults to
|
xlim |
manually specific x limits (in degrees of lontitude) |
ylim |
manually specific y limits (in degrees of latitude) |
This coordinate system provides the full range of map projections available in the mapproj package.
This is still experimental, and if you have any advice to offer regarding a better (or more correct) way to do this, please let me know
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | require("ggplot2")
require("maps")
# Create a lat-long dataframe from the maps package
nz <- data.frame(map("nz", plot=FALSE)[c("x","y")])
(nzmap <- qplot(x, y, data=nz, geom="path"))
nzmap + coord_map()
nzmap + coord_map(project="cylindrical")
nzmap + coord_map(project='azequalarea',orientation=c(-36.92,174.6,0))
states <- data.frame(map("state", plot=FALSE)[c("x","y")])
(usamap <- qplot(x, y, data=states, geom="path"))
usamap + coord_map()
# See ?mapproject for coordinate systems and their parameters
usamap + coord_map(project="gilbert")
usamap + coord_map(project="lagrange")
# For most projections, you'll need to set the orientation yourself
# as the automatic selection done by mapproject is not available to
# ggplot
usamap + coord_map(project="orthographic")
usamap + coord_map(project="stereographic")
usamap + coord_map(project="conic", lat0 = 30)
usamap + coord_map(project="bonne", lat0 = 50)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.