Package 'layer'

Title: Tilt your Maps and Turn Them into 'ggplot' Plots
Description: Simplifies the whole process of creating stacked tilted maps, that are often used in scientific publications to show different environmental layers for a geographical region. Tilting maps and layering them allows to easily draw visual correlations between these environmental layers.
Authors: Marco Sciaini [aut, cph], Cédric Scherer [aut], Josh Erickson [ctb], Egor Kotov [ctb, cre]
Maintainer: Egor Kotov <[email protected]>
License: CC0
Version: 0.0.3.9000
Built: 2025-02-02 10:25:48 UTC
Source: https://github.com/marcosci/layer

Help Index


Landscape 1

Description

Random curd neutral landscape model generated using the NLMR package.

Usage

landscape_1

Format

A raster object.

Source

Data generated using the NLMR package. See Sciaini et al. (2018) for details: doi:10.1111/2041-210X.13076.


Landscape 2

Description

Fractional Brownian motion neutral landscape model generated using the NLMR package.

Usage

landscape_2

Format

A raster object.

Source

Data generated using the NLMR package. See Sciaini et al. (2018) for details: doi:10.1111/2041-210X.13076.


Landscape 3

Description

Distance gradient neutral landscape model generated using the NLMR package.

Usage

landscape_3

Format

A raster object.

Source

Data generated using the NLMR package. See Sciaini et al. (2018) for details: doi:10.1111/2041-210X.13076.


Landscape Points

Description

Random curd neutral landscape model generated using the NLMR package.

Usage

landscape_points

Format

A raster object.

Source

Data generated using the NLMR package. See Sciaini et al. (2018) for details: doi:10.1111/2041-210X.13076.


Tilt raster and sf data

Description

Takes tilted maps and plots them with ggplot.

Usage

plot_tiltedmaps(
  map_list,
  layer = NA,
  palette = "viridis",
  color = "grey50",
  direction = 1,
  begin = 0,
  end = 1,
  alpha = 1
)

Arguments

map_list

sf or terra/stars/raster object.

layer

vector or list of names of each column in tilted sf object that should be used for coloring

palette

vector of palettes provided by the viridis and scico packages for rasters

color

a single color applied multiple times or a vector of color strings for points or linestrings

direction

vector of directions for viridis and scico color palettes

begin

vector of the of the start of interval the palette to sample colours from for viridis and scico color palettes

end

vector of the of the end of interval the palette to sample colours from for viridis and scico color palettes

alpha

vector of opacity for viridis and scico color palettes

Value

A ggplot object with stacked maps.

Examples

# tilt data
tilt_landscape_1 <- tilt_map(landscape_1)
tilt_landscape_2 <- tilt_map(landscape_2, x_shift = 50, y_shift = 50)

# plot
map_list <- list(tilt_landscape_1, tilt_landscape_2)
plot_tiltedmaps(map_list, palette = "turbo")

Tilt raster and sf data

Description

Tilt and shift maps in any direction.#'

Usage

tilt_map(
  data,
  x_stretch = 2,
  y_stretch = 1.2,
  x_tilt = 0,
  y_tilt = 1,
  x_shift = 0,
  y_shift = 0,
  angle_rotate = pi/20,
  boundary = NULL,
  parallel = FALSE
)

Arguments

data

sf or terra/stars/raster object.

x_stretch

Stretch in x dimension. A numeric vector of lenght 1.

y_stretch

Stretch in y dimension. A numeric vector of lenght 1.

x_tilt

Tilt in x dimension. A numeric vector of lenght 1.

y_tilt

Tilt in y dimension. A numeric vector of lenght 1.

x_shift

Shift in x dimension. A numeric vector of lenght 1.

y_shift

Shift in y dimension. A numeric vector of lenght 1.

angle_rotate

Rotation angle.. A numeric vector of lenght 1. Default is pi/20.

boundary

Another layer that is used to create a boundary that is drawn around the data

parallel

logical to run in parallel. FALSE (default)

Details

Code adopted from https://www.mzes.uni-mannheim.de/socialsciencedatalab/article/geospatial-data/.

Value

An sf object with tilted and shifted data.

Examples

tilt_map(landscape_1)