-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
106 lines (83 loc) · 2.59 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ridges <img src="man/figures/logo.png" align="right" width="120" />
<!-- badges: start -->
[](https://github.com/jansim/ridges/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
Download topographical elevation data for any location in the world and visualize it.
## Installation
You can install the development version of `ridges` from GitHub with:
``` r
# install.packages("remotes")
remotes::install_github("jansim/ridges")
```
## Usage
The package workflow is simple:
1. Select an area using the interactive map
2. Get elevation data for that area
3. Visualize the data
Here's a basic example of the different kinds of visualizations available.
```{r example, fig.height=5.7, fig.width=10, message=FALSE, warning=FALSE}
library(ridges)
# We'll use the included elevation data for the Wilder Kaiser mountain range
library(raster)
elevation <- ele_wilder_kaiser
# You can get your own data using the function `get_elevation()` (see below on how to select an area)
# elevation <- get_elevation(bb_wilder_kaiser)
# Create an elevation-based heatmap to check the data
plot_elevation(elevation)
# Create an elevation-based ridgeline plot
plot_ridgelines(elevation)
# Create a contour plot
plot_contours(ele_wilder_kaiser)
# Get the classic Joy Division Album Cover style
plot_ridgelines(
ele_wilder_kaiser,
fill_color = NA,
scale_factor = 12
)
# Vary the styling of the ridgelines
plot_ridgelines(
ele_wilder_kaiser,
line_color = "#000000",
fill_color = "white",
background_color = "white",
scale_factor = 8
)
# Get creative!
plot_contours(
ele_wilder_kaiser,
color_by_elevation = "both",
low_color = "#1A237E",
high_color = "#FF4081"
) + ggplot2::theme_void()
plot_ridgelines(
ele_wilder_kaiser,
n_lines = 35,
line_color = "#FF4081",
fill_color = "#FF408133",
background_color = "#1A237E"
)
```
### Getting Your Own Data
For interactive area selection, you can use `draw_bb()` to select an area on a map in your browser:
```{r eval=FALSE}
# Open an interactive map to select area
bb <- draw_bb("Innsbruck, Austria") # optionally center on a location
# Get elevation data for the selected area
elevation <- get_elevation(bb)
# Create your own ridgeline plot
plot_ridgelines(elevation)
```
## License
This project is licensed under the MIT License.