This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
105 lines (73 loc) · 2.78 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
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
[![Build Status](http://badges.herokuapp.com/travis/mdsumner/ozmaps?branch=master&env=BUILD_NAME=trusty_release&label=ubuntu)](https://travis-ci.org/mdsumner/ozmaps)
[![Build Status](http://badges.herokuapp.com/travis/mdsumner/ozmaps?branch=master&env=BUILD_NAME=osx_release&label=osx)](https://travis-ci.org/mdsumner/ozmaps)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/mdsumner/ozmaps?branch=master&svg=true)](https://ci.appveyor.com/project/mdsumner/ozmaps)
[![CRAN status](http://www.r-pkg.org/badges/version/ozmaps)](https://cran.r-project.org/package=ozmaps)
![cranlogs](http://cranlogs.r-pkg.org./badges/ozmaps)
[![Coverage Status](https://img.shields.io/codecov/c/github/mdsumner/ozmaps/master.svg)](https://codecov.io/github/mdsumner/ozmaps?branch=master)
```{r setup, include = FALSE}
library(dplyr)
library(sf)
library(rmapshaper)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
#knitr::read_chunk("data-raw/download_2016.R")
```
# Overview
The goal of ozmaps is to get maps of Australia to plot!
# Installation
ozmaps may be installed directly from github.
```{r, eval = FALSE}
devtools::install_github("mdsumner/ozmaps")
```
The package includes some *simple features* data, which can be used
independently of ozmaps with the 'sf' package. If required, install `sf` from CRAN.
```{r,eval=FALSE}
install.packages("sf")
```
## Usage
Plot Australia with states.
```{r}
library(ozmaps)
ozmap()
```
Plot Australia without states.
```{r}
ozmap(x = "country")
```
Add to an existing plot.
```{r}
plot(quakes[c("long", "lat")], xlim = c(120, 190))
ozmap(add = TRUE)
```
Obtain the data used in `sf` form.
```{r}
sf_oz <- ozmap_data("states")
tibble::as_tibble(sf_oz)
```
Plot with a custom palette.
```{r}
library(sf)
nmjr <- colorRampPalette(paletteer::paletteer_d(package = "ochRe", palette = "namatjira_qual"))(nrow(sf_oz))
plot(st_geometry(sf_oz), col = nmjr)
## soon...plot directly with ggplot2
library(ggplot2)
ggplot(sf_oz, aes(fill = NAME)) + geom_sf() + coord_sf(crs = "+proj=lcc +lon_0=135 +lat_0=-30 +lat_1=-10 +lat_2=-45 +datum=WGS84") + scale_fill_manual(values = nmjr)
```
Plot the ABS layers (from 2016).
```{r}
opal <- colorRampPalette(paletteer::paletteer_d(package = "ochRe", palette = "namatjira_qual"))
ozmap("abs_ced", col = opal(nrow(abs_ced)))
ozmap("abs_ste", col = opal(nrow(abs_ste)))
```
---
Please note that the 'ozmaps' project is released with a [Contributor Code of Conduct](https://github.com/mdsumner/ozmaps/blob/master/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.