R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("mapproj-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('mapproj') Loading required package: maps > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "map.grid" > > ### * map.grid > > flush(stderr()); flush(stdout()) > > ### Name: map.grid > ### Title: Draw a latitude/longitude grid on a projected map > ### Aliases: map.grid > ### Keywords: aplot > > ### ** Examples > > library(maps) > m <- map("usa",plot=FALSE) > map("usa",project="albers",par=c(39,45)) > map.grid(m) > > # get unprojected world limits > m <- map('world',plot=FALSE) > > # center on NYC > map('world',proj='azequalarea',orient=c(41,-74,0)) > map.grid(m,col=2) > points(mapproject(list(y=41,x=-74)),col=3,pch="x",cex=2) > > map('world',proj='orth',orient=c(41,-74,0)) Warning in map("world", proj = "orth", orient = c(41, -74, 0)) : projection failed for some data > map.grid(m,col=2,nx=6,ny=5,label=FALSE,lty=2) > points(mapproject(list(y=41,x=-74)),col=3,pch="x",cex=2) > > # center on Auckland > map('world',proj='orth',orient=c(-36.92,174.6,0)) Warning in map("world", proj = "orth", orient = c(-36.92, 174.6, 0)) : projection failed for some data > map.grid(m,col=2,label=FALSE,lty=2) > points(mapproject(list(y=-36.92,x=174.6)),col=3,pch="x",cex=2) > > m <- map('nz') > # center on Auckland > map('nz',proj='azequalarea',orient=c(-36.92,174.6,0)) > points(mapproject(list(y=-36.92,x=174.6)),col=3,pch="x",cex=2) > map.grid(m,col=2) > > > > cleanEx(); ..nameEx <- "mapproject" > > ### * mapproject > > flush(stderr()); flush(stdout()) > > ### Name: mapproject > ### Title: Apply a Map Projection > ### Aliases: mapproject > ### Keywords: dplot > > ### ** Examples > > library(maps) > # Bonne equal-area projection with state abbreviations > map("state",proj='bonne', param=45) > data(state) > text(mapproject(state.center), state.abb) > > # this does not work because the default orientations are different: > map("state",proj='bonne', param=45) > text(mapproject(state.center,proj='bonne',param=45),state.abb) > > map("state",proj="albers",par=c(30,40)) > map("state",par=c(20,50)) # another Albers projection > > map("world",proj="gnomonic",orient=c(0,-100,0)) # example of orient Warning in map("world", proj = "gnomonic", orient = c(0, -100, 0)) : projection failed for some data > # see map.grid for more examples > > > > ### *