ropensci / visdat

Preliminary Exploratory Visualisation of Data
https://docs.ropensci.org/visdat/
Other
453 stars 47 forks source link

colourblind palette shows false NA values #55

Open njtierney opened 7 years ago

njtierney commented 7 years ago

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 commented 1 year ago

Consider using the colorspace R package to resolve this issue