Learn R Programming

tmap (version 0.6)

tm_shape: Specify the shape object

Description

This element specifies the shape object. Also the used projection and covered area (bounding box) can be set.

Usage

tm_shape(shp, projection = NULL, xlim = NULL, ylim = NULL,
  relative = TRUE, bbox = NULL)

Arguments

shp
shape object, which is one of
  • "1)"
SpatialPolygons(DataFrame) "2)"

Value

item

  • projection
  • xlim
  • ylim
  • relative
  • bbox

code

ylim

url

  • http://trac.ostm.org/proj/
  • http://en.wikipedia.org/wiki/List_of_map_projections

describe

  • "longlat"Not really a projection, but a plot of the longitude-latitude coordinates.
  • "wintri"Winkel Tripel (1921). Popular projection that is useful in world maps. It is the standard of world maps made by the National tmgraphic Society. Type: compromise
  • "robin"Robinson (1963). Another popular projection for world maps. Type: compromise
  • "eck4"Eckert IV (1906). Projection useful for world maps. Area sizes are preserved, which makes it particularly useful for truthful choropleths. Type: equal-area
  • "hd"Hobo-Dyer (2002). Another projection useful for world maps in which area sizes are preserved. Type: equal-area
  • "gall"Gall (Peters) (1855). Another projection useful for world maps in which area sizes are preserved. Type: equal-area
  • "merc"Mercator (1569). Projection in which shapes are locally preserved. However, areas close to the poles are inflated. Google Maps uses a close variant of the Mercator. Type: conformal
  • "mill"Miller (1942). Projetion based on Mercator, in which poles are displayed. Type: compromise
  • "eqc0"Equirectangular (120). Projection in which distances along meridians are conserved. The equator is the standard parallel. Also known as Plate Carr'ee. Type: equidistant
  • "eqc30"Equirectangular (120). Projection in which distances along meridians are conserved. The latitude of 30 is the standard parallel. Type: equidistant
  • "eqc45"Equirectangular (120). Projection in which distances along meridians are conserved. The latitude of 45 is the standard parallel. Also known as Gall isographic. Type: equidistant
  • "rd"Rijksdriehoekstelsel. Triangulation coordinate system used in the Netherlands.

See Also

set_projection, ../doc/tmap-nutshell.html{vignette("tmap-nutshell")}

Examples

Run this code
data(World)

tm_shape(World, projection="longlat") + 
    tm_fill() +
    tm_borders() + 
    tm_layout("Long lat coordinates (WGS84)", inner.margins=c(0,0,.1,0), title.cex=.8)

World$highlighted <- ifelse(World$iso_a3 %in% c("GRL", "AUS"), "gold", "gray75")
tm_shape(World, projection="merc") + 
    tm_fill("highlighted") + 
    tm_borders() + 
    tm_layout("Mercator projection. Although used in Google Maps, it is discouraged for
statistical purposes. In reality, Australia is 3 times larger than Greenland!", 
inner.margins=c(0,0,.1,0), title.cex=.6)


tm_shape(World, projection="wintri") + 
    tm_fill() + 
    tm_borders() + 
    tm_layout(
"Winkel-Tripel projection, adapted as default by the National Geographic Society for world maps", 
inner.margins=c(0,0,.1,0), title.cex=.8)

tm_shape(World) +
    tm_fill() + 
    tm_borders() + 
tm_layout("Eckhart IV projection. Recommended in statistical maps for its equal-area property", 
    inner.margins=c(0,0,.1,0), title.cex=.8)

Run the code above in your browser using DataLab