The taichi geom turns each cell of a heatmap-like grid into a taichi
(yin-yang) diagram. The two interlocking "fish" of the diagram use luminance
to show the values from two data sources on the same plot, so four
dimensions of data can be expressed at once: the x and y
position of every taichi symbol plus the yin and yang values
that fill its two halves.
Arguments
- yin
The column name for the yin (dark) fish of the taichi symbol.
- yin_name
The label name (in quotes) for the legend of the yin rendering. Default is
NULL.- yin_colors
A color vector, usually as hex codes.
- yang
The column name for the yang (light) fish of the taichi symbol.
- yang_name
The label name (in quotes) for the legend of the yang rendering. Default is
NULL.- yang_colors
A color vector, usually as hex codes.
- ...
...accepts any argumentsscale_fill_gradientn()has .
Examples
# taichi with categorical variables only
library(ggplot2)
data <- data.frame(x = rep(c("a", "b", "c"), 3),
y = rep(c("d", "e", "f"), 3),
yin_values = rep(c(1,5,7),3),
yang_values = rep(c(2,3,4),3))
ggplot(data, aes(x,y)) +
geom_taichi(yin = yin_values,
yang = yang_values)
# taichi with numeric variables only
data <- data.frame(x = rep(c(1, 2, 3), 3),
y = rep(c(1, 2, 3), 3),
yin_values = rep(c(1,5,7),3),
yang_values = rep(c(2,3,4),3))
ggplot(data, aes(x,y)) +
geom_taichi(yin = yin_values,
yang = yang_values)
# taichi with a mixture of numeric and categorical variables
data <- data.frame(x = rep(c("a", "b", "c"), 3),
y = rep(c(1, 2, 3), 3),
yin_values = rep(c(1,5,7),3),
yang_values = rep(c(2,3,4),3))
ggplot(data, aes(x,y)) +
geom_taichi(yin = yin_values,
yang = yang_values)