## Not run:
# if(.Platform$OS.type == "windows")
# windows.options(width=13, height=9) # Set the window to be wider than high.
#
# imap() # On the figure, left-click two corners of an area you would like to zoom in on.
# # Creating a rectangle outside the figure region will zoom out locally.
# # Double left-click on the same spot to zoom back out to the original data. Right-click to stop.
#
# imap(antarctic = TRUE) # Reset with two left-clicks in the same spot for a more symmetrical picture.
#
# imap(list(world.h.land, imap(world.h.land)[[1]]$ll)) # Whatever area is selected in the first use of imap()
# # will be a different color in the second imap().
#
# col.alpha('magenta', alpha = 0.5) # Look at the color value for magenta that has an alpha transparency value of 0.5 .
#
# # Use this color so there is transparency where rivers and borders are the in the same location.
# # Also note that the land was made a lighter grey by going from grey40 to grey50.
# imap(list(world.h.land, world.h.lake, world.h.island, world.h.pond.in.island, world.h.borders, world.h.rivers),
# longrange = c(-89, -99), latrange = c(41, 50), col=c("black", "blue", "forestgreen", "dodgerblue",
# "cyan", col.alpha('magenta', alpha = 0.5)), poly = c("grey50", "blue", "forestgreen", "dodgerblue", NA, NA), zoom = FALSE)
#
# # All the world's rivers with zoom turned back on (may take a while to finish).
# imap(list(world.h.land, world.h.lake, world.h.island, world.h.pond.in.island, world.h.borders, world.h.rivers),
# col=c("black", "blue", "forestgreen", "dodgerblue", "cyan", col.alpha('magenta', alpha = 0.5)),
# poly = c("grey50", "blue", "forestgreen", "dodgerblue", NA, NA))
#
# test <- ilines(list(npacific, select.lines(ilines(npacific)[[1]]$ll))) # Zoom, right-click, select one or more lines, right-click.
# test[[2]]$lwd <- 3 # Change attributes manually and
# ilines(test) # keep the default keep.attr = TRUE, or
# test <- ilines(test, col=c("magenta", "goldenrod"), lwd = c(2,5), keep.attr = FALSE) # set keep.attr = FALSE and use parameter options.
#
# imap(longrange = c(-84.5, -81), latrange = c(44.5, 47)) # An example of ponds on an island in the Great Lakes Region.
# # Use zoom = F for a static map, to which additional data may be added.
#
# # To create a file from a finished map use dev.copy2eps(), dev.copy2pdf(), or the following function for 'png'.
# dev.copy2png <- function(file = 'Rplot.png', factor.exp = 1, ...) {
#
# dev.copy(png, file=file, width=par()$fin[1] * factor.exp, height=par()$fin[2] * factor.exp, units="in", res=72, ...)
# dev.off()
# }
#
#
# # Use with 'Maps' library
# require(maps)
# require(mapproj)
#
# map.to.imap <- function (map.list) {
#
# matrix(cbind(map.list[[1]], map.list[[2]]), ncol = 2)
# }
#
# # Compare this map
# imap(map.to.imap(map('usa')))
#
# # With this one
# windows()
# imap(map.to.imap(map('usa', proj="bonne", param=45)), aspect=1)
#
# # Plot without axes
# imap(map.to.imap(map('usa', proj="bonne", param=45)), aspect=1, axes=FALSE)
#
# # Select an area to highlight and then re-zoom
# ilines(list(map.to.imap(map(projection = "gnomonic")),
# ilines(map.to.imap(map(projection = "gnomonic")), aspect=1.5, axes=FALSE)[[1]]$ll), aspect=1.5, axes=FALSE)
# ## End(Not run)
Run the code above in your browser using DataLab