corrmorant_selectors: corrmorant selectors

Description Usage Arguments Details Value See Also Examples

Description

Selector functions that can be used to modify the mapping of ggplot layers to a subset of panels in ggcorrm plots.

Usage

1
2
3
4
5
lotri(layer)

utri(layer)

dia(layer)

Arguments

layer

A ggplot layer (created by a call to a geom or a stat, or to the ggplot2::layer()).

Details

The corrmorant selector functions lotri(), utri() and dia() modify the data slot of ggplot layers (invoked by a call to a geom, a stat or layer()) to make sure that they are only displayed in the desired panels of ggcorrm plot.

lotri() shows the layer only in panels of the lower triangle, utri() in the upper triangle and dia() in the panels of the plot diagonal.

If no data are specified explicitly in the layer, the selectors filter the data for the desired panels from the tidy_corrm data the plot is based upon. If data are specified in layer via its data argument, it either plots it to all upper/lower triangle or diagonal panels (depending on the type of selector) or matches it to the desired rows/columns if any variables named var_x, var_y and/or pos are present in the new dataset.

The combination of lotri() and utri() in combination with regular ggplot2 geoms should be sufficient for the a large number of use cases for data displa in the lower and upper triangle of a correlation plot. However, dia() in combination with regular geoms is often problematic for useful displays on the diagonal facets, as they are often reserved for data summaries that are difficult to place correctly in the facets when the data have different ranges. A series of common data summaries for the plot diagonal are provided with the functions dia_names, dia_density, dia_histogram and dia_freqpoly, which automatically take care of the correct placement.

In addition, there are plenty of stats specifically designed for the use in offdiagonal corrmorant facets that all exist in two versions, e.g. lotri_corrtext and utri_corrtext.

Value

A ggplot2 layer with modified data.

See Also

ggcorrm(), tidy_corrm(), corrmorant()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
if(interactive()){
# plot with points on the lower triangle
ggcorrm(drosera) +
  utri(geom_point(alpha = 0.4)) +
  lotri_corrtext() +
  dia_density(fill = "grey50") +
  dia_names(size = 3)

# same plot with inverted lower and upper triangle
ggcorrm(drosera) +
  lotri(geom_point(alpha = 0.4)) +
  utri_corrtext() +
  dia_density(fill = "grey50") +
  dia_names(size = 3)
 }

## End(Not run)

r-link/corrmorant documentation built on Jan. 10, 2021, 7:26 p.m.