I have a table:
and i need to fill cells with value = 0
with red color.
I realize i need data_color but how to set palette with 2 colors? red if value==0
, white if value<>0
?
I've found an example:
data_color(
columns = colnames(updates.computers)[2:ncol(updates.computers)],
colors = scales::col_numeric(
palette = paletteer::paletteer_d(
palette = "ggsci::red_material", direction = -1
) %>% as.character(),
domain = NULL
),
alpha = 0.8)
But it's not what I need.
I just need cells with 0 to be Red, and all the rest to stay White.
Have a look at the
scales::col_bin
function. By cutting the data into two bins (0 and from 1 to infinity) you can specify the colors for each bin.