visdat icon indicating copy to clipboard operation
visdat copied to clipboard

colourblind palette shows false NA values

Open njtierney opened this issue 6 years ago • 1 comments

When using palette = "cb_safe" in vis_dat, it shows missing values where there are none

library(visdat)
library(naniar)
library(tidyverse)
#> Loading tidyverse: ggplot2
#> Loading tidyverse: tibble
#> Loading tidyverse: tidyr
#> Loading tidyverse: readr
#> Loading tidyverse: purrr
#> Loading tidyverse: dplyr
#> Conflicts with tidy packages ----------------------------------------------
#> filter(): dplyr, stats
#> lag():    dplyr, stats

# shows missing values where there are none
pedestrian %>% 
  filter(month=="January", 
         year==2016) %>%
  vis_dat(palette = "cb_safe") +
  theme(aspect.ratio=1)

But if you use regular vis_dat, then there are no missing values shown.


# missing values not shown
pedestrian %>% 
  filter(month=="January", 
         year==2016) %>%
  vis_dat() +
  theme(aspect.ratio=1)

Need to dig into what happens here.

Thanks @dicook for pointing this out!

njtierney avatar Aug 29 '17 23:08 njtierney

Consider using the colorspace R package to resolve this issue

njtierney avatar Feb 01 '23 03:02 njtierney