Create correlation matrices and heatmaps using Insper's visual identity. Automatically detects whether data is a matrix or pre-melted long format.
Usage
insper_heatmap(
data,
show_values = FALSE,
value_color = "white",
value_size = 3,
palette = "diverging",
...
)Arguments
- data
Data frame (melted with Var1, Var2, value columns) or correlation matrix
- show_values
Logical. If TRUE, displays values on tiles. Default is TRUE
- value_color
Character. Color for value text. Default is "white"
- value_size
Numeric. Size of value text. Default is 3
- palette
Character. Palette name for fill scale. Default is "diverging"
- ...
Additional arguments passed to
ggplot2::geom_tile()
Examples
if (FALSE) { # has_insper_fonts()
# From correlation matrix
cor_mat <- cor(mtcars[, 1:4])
insper_heatmap(cor_mat)
# Hide values
insper_heatmap(cor_mat, show_values = FALSE)
# Custom palette
insper_heatmap(cor_mat, palette = "red_teal")
}
