Create a Heatmap Chart
v_heatmap.Rd
Create a Heatmap Chart
Usage
v_heatmap(
vc,
mapping = NULL,
data = NULL,
name = NULL,
...,
serie_id = NULL,
data_id = NULL
)
Arguments
- vc
A chart initialized with
vchart()
.- mapping
Default list of aesthetic mappings to use for chart.
- data
Default dataset to use for chart. If not already a
data.frame
, it will be coerced to withas.data.frame
.- name
Name for the serie, only used for single serie (no
color
/fill
aesthetic supplied).- ...
Additional parameters for the serie.
- data_id, serie_id
ID for the data/serie, can be used to further customize the chart with
v_specs()
.
Value
A vchart()
htmlwidget
object.
Examples
library(vchartr)
# Heatmap with continuous fill variable
vchart(co2_emissions) %>%
v_heatmap(aes(x = year, y = country, fill = co2_per_capita))
# Change colors
vchart(co2_emissions) %>%
v_heatmap(aes(x = year, y = country, fill = co2_per_capita)) %>%
v_specs_colors(
range = rev(
c("#8C510A", "#BF812D", "#DFC27D", "#F6E8C3",
"#C7EAE5", "#80CDC1", "#35978F", "#01665E")
)
)
# Heatmap with discrete fill variable
vchart(co2_emissions) %>%
v_heatmap(aes(x = year, y = country, fill = co2_growth_change))
# Change colors
vchart(co2_emissions) %>%
v_heatmap(aes(x = year, y = country, fill = co2_growth_change)) %>%
v_scale_fill_manual(c(
Increase = "firebrick",
Decrease = "forestgreen"
))