File: README.md

package info (click to toggle)
r-cran-ggplot.multistats 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 92 kB
  • sloc: makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download
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
[![CRAN badge][]](https://cran.r-project.org/package=ggplot.multistats) [![Workflow badge][]](https://github.com/flying-sheep/ggplot.multistats/commits/master)

[CRAN badge]: https://www.r-pkg.org/badges/version/ggplot.multistats
[Workflow badge]: https://github.com/flying-sheep/ggplot.multistats/workflows/Build%20R%20package/badge.svg

ggplot.multistats
=================

`ggplot.multistats` currently provides `stat_summaries_hex` and some helpers.

`stat_summaries_hex` is similar to [`ggplot2::stat_summary_hex`][stat_summary_2d],
but allows specifying multiple stats using the `funs` parameter (see [Example](#Example)).

[stat_summary_2d]: https://ggplot2.tidyverse.org/reference/stat_summary_2d.html

Installation
------------
`ggplot.multistats` is on [CRAN](https://CRAN.R-project.org).

```r
install.packages('ggplot.multistats')
```

You can also install the development version from GitHub:

```r
# install.packages('devtools')
devtools::install_github('flying-sheep/ggplot.multistats')
```

Example
-------
Specify a summary variable using the `z` aesthetic
and specify a list of `funs` to provide `after_stat`s for you:

```r
library(ggplot2)
library(ggplot.multistats)

ggplot(iris, aes(Sepal.Width, Sepal.Length)) +
  stat_summaries_hex(
    aes(z = Petal.Width, fill = after_stat(median), alpha = after_stat(n)),
    funs = c('median', n = 'length'),
    bins = 5
  )
```

![](example.png)