-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
134 lines (98 loc) · 4.96 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
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 = NULL
)
Sys.setenv(LANGUAGE = "en") # Force locale
```
# isopleuros <img width=120px src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/tesselle/isopleuros/workflows/R-CMD-check/badge.svg)](https://github.com/tesselle/isopleuros/actions)
[![codecov](https://codecov.io/gh/tesselle/isopleuros/branch/main/graph/badge.svg?token=QnnAqgIIUp)](https://app.codecov.io/gh/tesselle/isopleuros)
[![CodeFactor](https://www.codefactor.io/repository/github/tesselle/isopleuros/badge/main)](https://www.codefactor.io/repository/github/tesselle/isopleuros/overview/main)
[![Dependencies](https://tinyverse.netlify.app/badge/isopleuros)](https://cran.r-project.org/package=isopleuros)
[![r-universe](https://tesselle.r-universe.dev/badges/isopleuros)](https://tesselle.r-universe.dev/isopleuros){.pkgdown-devel}
[![CRAN Version](https://www.r-pkg.org/badges/version/isopleuros)](https://cran.r-project.org/package=isopleuros){.pkgdown-release}
[![CRAN checks](https://badges.cranchecks.info/worst/isopleuros.svg)](https://cran.r-project.org/web/checks/check_results_isopleuros.html){.pkgdown-release}
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/isopleuros)](https://cran.r-project.org/package=isopleuros){.pkgdown-release}
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7940389.svg)](https://doi.org/10.5281/zenodo.7940389)
<!-- badges: end -->
## Overview
Ternary plots made simple. **isopleuros** allows to create ternary plots using base **graphics**. It provides functions to display the data in the ternary space, to add or tune graphical elements and to display statistical summaries. It also includes common ternary diagrams useful for the archaeologist (e.g. soil texture charts, ceramic phase diagram).
**isopleuros** is a dependency-free package^[The only exception is the `ternary_contour()` function for which the [**interp**](https://cran.r-project.org/package=interp) package is required, but is not installed by default.] designed to be as simple as possible. If you need finer tuning or more advanced features, you should consider the [**Ternary**](https://ms609.github.io/Ternary/) or [**ggtern**](http://www.ggtern.com/) package.
---
```{r citation, echo=FALSE, comment='', results='asis'}
cite <- utils::citation("isopleuros")
print(cite, bibtex = FALSE)
```
## Installation
You can install the released version of **isopleuros** from [CRAN](https://CRAN.R-project.org) with:
```{r cran-installation, eval=FALSE}
install.packages("isopleuros")
```
And the development version from [GitHub](https://github.com/) with:
```{r gh-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_github("tesselle/isopleuros")
```
## Usage
```{r packages-load}
## Load package
library(isopleuros)
```
```{r ternary, fig.width=7, fig.height=3.5, fig.align='center'}
## Graphical parameters
par(mfrow = c(1, 2), mar = c(0, 0, 0, 0) + 0.1)
## Set colors
col <- c("blue", "red")
## Ternary plot
## (data from Aitchison 1986)
ternary_plot(
x = lava,
panel.first = ternary_grid(),
col = col[as.factor(lava$A > 30)],
)
## Split data
groups <- split(lava, f = lava$A > 30)
## Add tolerance ellipses
for (i in seq_along(groups)) {
ternary_tolerance(groups[[i]], level = 0.975, lty = 2, border = col[[i]])
}
## Density contours
ternary_plot(lava, panel.first = ternary_grid())
ternary_density(lava, n = 500, nlevels = 10)
```
```{r pairs, fig.width=7, fig.height=7, fig.align='center'}
## Install extra package (if needed)
# install.packages("folio")
## Data from Barrera and Velde 1989
data("verre", package = "folio")
## Select data
coda <- verre[, c("Na2O", "CaO", "K2O", "MgO", "P2O5", "Al2O3")]
## Ternary plots with marginal compositions
ternary_pairs(coda, col = as.factor(coda$Na2O > 5))
```
```{r charts, fig.width=7, fig.height=7, fig.align='center'}
## Graphical parameters
par(mfrow = c(2, 2), mar = c(0, 0, 0, 0) + 0.1)
## Ceramic phase diagram
ternary_plot(NULL, axes = FALSE, ann = FALSE, frame.plot = TRUE)
triangle_phase_cas(symbol = TRUE, pch = 16)
ternary_plot(NULL, xlab = "CaO", ylab = "Al2O3", zlab = "SiO2")
triangle_phase_ceramic(symbol = TRUE, pch = 16)
## HYPRES soil texture
ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay")
triangle_soil_hypres()
## USDA (1951) soil texture
ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay")
triangle_soil_usda(symbol = TRUE)
```
## Contributing
Please note that the **isopleuros** project is released with a [Contributor Code of Conduct](https://www.tesselle.org/conduct.html). By contributing to this project, you agree to abide by its terms.