-
Notifications
You must be signed in to change notification settings - Fork 9
/
README.Rmd
90 lines (65 loc) · 3.42 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r opts, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
warning = TRUE,
message = FALSE,
width = 120,
comment = "#>",
fig.retina = 2,
fig.path = "man/figures/README-"
)
```
# layer <a><img src='man/figures/logo.svg' align="right" height=210 width=182/></a>
<!-- badges: start -->
[![R build
status](https://github.com/marcosci/layer/workflows/R-CMD-check/badge.svg)](https://github.com/marcosci/layer/actions?query=workflow%3AR-CMD-check)
[![Project Status: Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/layer)](https://cran.r-project.org/web/packages/layer/)
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/layer?color=orange)](https://cran.r-project.org/package=layer)
<!-- badges: end -->
The goal of `layer` is to simplify 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.
Something in the line of:
```{r, echo = FALSE, fig.alt = "Example of a stacked tilted map by Cédric Scherer and Marco Sciaini"}
knitr::include_graphics("man/figures/example.jpg_large")
```
## Installation
You can install the development version of layer from [GitHub](https://github.com/) with:
```{r, eval = FALSE}
# install.packages("remotes")
remotes::install_github("marcosci/layer")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r example, fig.alt = "Basic example of a stacked tilted map"}
library(layer)
tilt_landscape_1 <- tilt_map(landscape_1)
tilt_landscape_2 <- tilt_map(landscape_2, x_shift = 25, y_shift = 50)
tilt_landscape_3 <- tilt_map(landscape_3, x_shift = 50, y_shift = 100)
tilt_landscape_points <- tilt_map(landscape_points, x_shift = 75, y_shift = 150)
map_list <- list(tilt_landscape_1, tilt_landscape_2, tilt_landscape_3, tilt_landscape_points)
plot_tiltedmaps(map_list,
layer = c("value", "value", "value", NA),
palette = c("bilbao", "mako", "rocket", NA),
color = "grey40")
```
### More advanced example
Some more realistic looking data (DEM, drought, precipitation, and wildfires for continental USA):
```{r adv-example, eval = !file.exists("man/figures/README-adv-example.png"), fig.alt = "Advanced example of a stacked tilted map"}
tilt_landscape_1 <- tilt_map(dem_usa, y_tilt = 3)
tilt_landscape_2 <- tilt_map(drought_usa, y_tilt = 3, x_shift = 15, y_shift = 25)
tilt_landscape_3 <- tilt_map(prec_usa, y_tilt = 3, x_shift = 30, y_shift = 50)
tilt_landscape_4 <- tilt_map(fire_usa, y_tilt = 3, x_shift = 45, y_shift = 65)
map_list <- list(tilt_landscape_1, tilt_landscape_2, tilt_landscape_3, tilt_landscape_4)
plot_tiltedmaps(map_list, palette = c("tofino", "rocket", "mako", "magma"), direction = c(-1, 1, 1, 1))
```
```{r, echo = FALSE, fig.alt = "Advanced example of a stacked tilted map"}
knitr::include_graphics("man/figures/README-adv-example.png")
```
## Code of Conduct
Please note that the `layer` project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.