This repository has been archived by the owner on May 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.Rmd
99 lines (71 loc) · 3.63 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
---
output: github_document
editor_options:
chunk_output_type: console
---
[![Travis build status](https://travis-ci.org/Maschette/SOmap.svg?branch=master)](https://travis-ci.org/Maschette/SOmap)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/Maschette/SOmap?branch=master&svg=true)](https://ci.appveyor.com/project/Maschette/SOmap)
[![Coverage status](https://codecov.io/gh/Maschette/SOmap/branch/master/graph/badge.svg)](https://codecov.io/github/Maschette/SOmap?branch=master)
[![CRAN status](https://www.r-pkg.org/badges/version/SOmap)](https://cran.r-project.org/package=SOmap)
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(SOmap)
library(raster)
library(rgdal)
#load("C:/Users/dale_mas/Documents/ice.rda")
```
# Development of SOmap has moved to the [AAD repository](https://github.com/AustralianAntarcticDivision/SOmap)
# SOmap <img src="man/figures/logo.png" align="right" />
The goal of SOmap is to make publication quality round Southern Ocean maps in polar projections with little effort. This package is still very much a work in progress contact me with any questions or suggestions.
## Installation
The development version from [GitHub](https://github.com/Maschette/SOmap) with:
``` r
# install.packages("devtools")
devtools::install_github("Maschette/SOmap")
```
## Example
To make a simple map you can use the following function; use ?SOmap to see all the options for modifying layers.
```{r examplemap, fig.height=5,fig.width=5, dpi=300}
library(SOmap)
SOmap()
```
There is also `SOmanagement()` which have management layers for the Southern Ocean and `SOleg()` which gives custom rounded legends for added map layers
```{r management, echo = T, fig.height=5,fig.width=5, dpi=300}
## custom colours
spiritedMedium <- grDevices::colorRampPalette(c("#4D4140", "#596F7E", "#168B98", "#ED5B67", "#E27766", "#DAAD50", "#EAC3A6"))
spirited <- spiritedMedium(80)
SOmap::SOmap()
SOleg(position = "topright",
col = spirited,
ticks = 6,
tlabs = c("0","20","40","60","80","100"),
Trim = -45,
label = "Sea Ice")
plot(ice, col = spirited, add=TRUE, legend = FALSE, alpha = 0.95) ## From raadtools
SOmanagement(EEZ = TRUE)
```
An **automatic** plot function `SOauto_map()` will take any data in the form of longitude and latitude vectors and create a guess at a map. It returns the data used to make the map so that further customization can be made.
```{r automap, fig.height=5,fig.width=5, dpi=300}
ellie <- SOmap_data$mirounga_leonina
track <- head(do.call(rbind, lapply(split(ellie, ellie$id), function(x) rbind(as.matrix(x[c("lon", "lat")], NA)))),-1)
SOauto_map(track[,1], track[,2])
graphics.off()
data("albatross", package = "adehabitatLT")
albatrack <- rgdal::project(as.matrix(purrr::map_df(albatross, ~rbind(.x[c("x", "y")], NA))), "+proj=utm +zone=42 +south +datum=WGS84", inv = TRUE)
ellie_map <- SOauto_map(albatrack[,1], albatrack[,2])
```
Notice how we may use the plot interactively or also return the data for further exploration.
```{r automap-data}
names(ellie_map)
```
Objects from `sf` or `sp` may also be used. (If a 'raster' is given it is used only for its extent. )
```{r automap-spatial, fig.height=5,fig.width=5, dpi=300}
SOauto_map(SOmap_data$fronts_orsi, family = "laea", centre_lon = 147, input_points = FALSE)
```
Please note that the 'SOmap' project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.