Package 'ggswissmaps'

Title: Offers Various Swiss Maps as Data Frames and 'ggplot2' Objects
Description: Offers various swiss maps as data frames and 'ggplot2' objects and gives the possibility to add layers of data on the maps. Data are publicly available from the swiss federal statistical office. In addition to the \code{maps2} object (a list of 8 swiss maps, at various levels), there are the data frames with the boundaries used to produce these maps (\code{shp_df}, a list with 8 data frames).
Authors: Sandro Burri [aut, cre], Eric Stephani [aut], Lisa Bottinelli [ctb]
Maintainer: Sandro Burri <[email protected]>
License: GPL-2
Version: 0.1.2
Built: 2025-01-01 04:51:46 UTC
Source: https://github.com/gibonet/ggswissmaps

Help Index


A list with 8 'ggplot2' objects of swiss territory boundaries, at various levels.

Description

Every element of the list is a 'ggplot2' graphic, corresponding to an element of shp_df.

Usage

maps2

Format

A list with 8 data frames with swiss territory boundaries (at various levels).

Details

Columns are not all the same across data frames, but usually they have the following in common:

  • long. Longitude coordinate (x)

  • lat. Latitude coordinate (y)

  • group. A factor to be used to plot the polygons correctly (with ggplot2)

Source

https://www.bfs.admin.ch/bfs/fr/home/services/geostat/geodonnees-statistique-federale/limites-administratives/limites-communales-generalisees.html. Download date: 2015-08-18

Examples

class(maps2)
length(maps2)
names(maps2)
# str(maps2[["g1k15"]])

# By name
maps2[["g1k15"]]

# By index
maps2[[5]]

Prepares the base of a map, starting from a data frame with longitude (long) and latitude (lat) coordinates, as a 'ggplot2' object

Description

Prepares the base of a map, starting from a data frame with longitude (long) and latitude (lat) coordinates, as a 'ggplot2' object

Usage

maps2_(
  data,
  mapping = ggplot2::aes_string(x = "long", y = "lat", group = "group"),
  caption = "Boundaries: BFS GEOSTAT / swisstopo"
)

Arguments

data

data frame with longitude, latitude and group coordinates of a territory (polygons)

mapping

Aesthetic mappings, as character strings (link{ggplot2::aes_string}). Defaults are x = "long", y = "lat" and group = "group" (these work with every element of the list shp_df of ggswissmaps)

caption

text to include in the lower right corner of the map (default: "Boundaries: BFS GEOSTAT / swisstopo")

Examples

data(shp_df)
maps2_(data = shp_df[[1]])

A list with 8 data frames of swiss territory boundaries, at various levels.

Description

Every element of the list is a data frame, which can be used with 'ggplot2'.

Format

A list with 8 data frames with swiss territory boundaries (at various levels).

Details

Columns are not all the same across data frames, but usually they have the following in common:

  • long. Longitude coordinate (x)

  • lat. Latitude coordinate (y)

  • group. A factor to be used to plot the polygons correctly (with ggplot2)

Source

https://www.bfs.admin.ch/bfs/fr/home/services/geostat/geodonnees-statistique-federale/limites-administratives/limites-communales-generalisees.html. Download date: 2015-08-18

Examples

data(shp_df)
class(shp_df)
length(shp_df)
names(shp_df)
str(shp_df[["g1k15"]])

A list with 8 'sf' objects of swiss territory boundaries, at various levels.

Description

Every element of the list is a 'sf' data frame, which can be used with 'ggplot2'.

Format

A list with 8 'sf' data frames with swiss territory boundaries (at various levels).

Details

Every 'sf' data frame has a column "geometry", which is a list-column containing the boundaries of the polygons.

See the vignette (vignette("ggswissmaps_with_sf", package = "ggswissmaps")) for some examples.

Source

https://www.bfs.admin.ch/bfs/fr/home/services/geostat/geodonnees-statistique-federale/limites-administratives/limites-communales-generalisees.html. Download date: 2015-08-18

Examples

data(shp_sf)
class(shp_sf)
length(shp_sf)
names(shp_sf)
str(shp_sf[["g1k15"]])

theme_white_f is a 'ggplot2' theme function that can be added to a 'ggplot2' object to eliminate axes, ticks and put white background

Description

theme_white_f is a 'ggplot2' theme function that can be added to a 'ggplot2' object to eliminate axes, ticks and put white background

Usage

theme_white_f(base_size = 12, base_family = "")

Arguments

base_size

base font size

base_family

base font family