njtierney/naniar

add white lines to clearly separate the missing values in `geom_missing_point`

Aperta

#30 aperta il 24 dic 2016

 (5 commenti) (2 reazioni) (0 assegnatari)R (56 fork)batch import
enhancementhelp wantedvisualisation

Metriche repository

Star
 (674 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

For example:

library(naniar)
library(ggplot2)
# method to draw new white band
y_white_band <- min(airquality$Solar.R, 
                    na.rm = TRUE) - 0.95 * min(airquality$Solar.R, 
                                               na.rm = TRUE)

x_white_band <- min(airquality$Ozone, 
                    na.rm = TRUE) - 0.95 * min(airquality$Solar.R, 
                                               na.rm = TRUE)

ggplot(data = airquality,
       aes(x = Ozone,
           y = Solar.R)) +
  geom_missing_point() + 
  # geom_hline(yintercept = -3,
  geom_hline(yintercept = y_white_band,
             size = 2,
             colour = "white") +
  # geom_vline(xintercept = -3,
  geom_vline(xintercept = x_white_band,
             size = 2,
             colour = "white")

As opposed to

ggplot(data = airquality,
       aes(x = Ozone,
           y = Solar.R)) +
  geom_missing_point() 

Guida contributor