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 |
Every element of the list is a 'ggplot2' graphic, corresponding to an
element of shp_df
.
maps2
maps2
A list with 8 data frames with swiss territory boundaries (at various levels).
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)
https://www.bfs.admin.ch/bfs/fr/home/services/geostat/geodonnees-statistique-federale/limites-administratives/limites-communales-generalisees.html. Download date: 2015-08-18
class(maps2) length(maps2) names(maps2) # str(maps2[["g1k15"]]) # By name maps2[["g1k15"]] # By index maps2[[5]]
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
maps2_( data, mapping = ggplot2::aes_string(x = "long", y = "lat", group = "group"), caption = "Boundaries: BFS GEOSTAT / swisstopo" )
maps2_( data, mapping = ggplot2::aes_string(x = "long", y = "lat", group = "group"), caption = "Boundaries: BFS GEOSTAT / swisstopo" )
data |
data frame with longitude, latitude and group coordinates of a territory (polygons) |
mapping |
Aesthetic mappings, as character strings ( |
caption |
text to include in the lower right corner of the map (default: "Boundaries: BFS GEOSTAT / swisstopo") |
data(shp_df) maps2_(data = shp_df[[1]])
data(shp_df) maps2_(data = shp_df[[1]])
Every element of the list is a data frame, which can be used with 'ggplot2'.
A list with 8 data frames with swiss territory boundaries (at various levels).
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)
https://www.bfs.admin.ch/bfs/fr/home/services/geostat/geodonnees-statistique-federale/limites-administratives/limites-communales-generalisees.html. Download date: 2015-08-18
data(shp_df) class(shp_df) length(shp_df) names(shp_df) str(shp_df[["g1k15"]])
data(shp_df) class(shp_df) length(shp_df) names(shp_df) str(shp_df[["g1k15"]])
Every element of the list is a 'sf' data frame, which can be used with 'ggplot2'.
A list with 8 'sf' data frames with swiss territory boundaries (at various levels).
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.
https://www.bfs.admin.ch/bfs/fr/home/services/geostat/geodonnees-statistique-federale/limites-administratives/limites-communales-generalisees.html. Download date: 2015-08-18
data(shp_sf) class(shp_sf) length(shp_sf) names(shp_sf) str(shp_sf[["g1k15"]])
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
theme_white_f(base_size = 12, base_family = "")
theme_white_f(base_size = 12, base_family = "")
base_size |
base font size |
base_family |
base font family |