Open pepijnvink opened 11 months ago
Your solution does work, only the axis ticks are overlapping. Use this to remove:
ggmice::plot_pattern(data.frame(rbind(rep(NA, 100), 1:100)), grid = FALSE) + ggplot2::scale_x_discrete(breaks = 0)
Your solution does work, only the axis ticks are overlapping. Use this to remove:
ggmice::plot_pattern(data.frame(rbind(rep(NA, 100), 1:100)), grid = FALSE) + ggplot2::scale_x_discrete(breaks = 0)
It may be useful to put this in a vignette or make it a separate statement (rather than default). Should choose whether to do only x, y, or both/together. In some cases, for example, it may be more useful to only remove the y axis breaks (if it is to improve visibility):
library(ggmice)
library(ggplot2)
# Simulate some example data
nvar <- 10
n <- 1000000
mat <- matrix(data = NA, nrow = n, ncol = nvar)
colnames(mat) <- paste0("V", 1:nvar)
set.seed(42)
for(i in 1:nvar){
val <- sample(c(1, NA), size = n, replace = TRUE)
val2 <- ifelse(!is.na(val), rnorm(n), NA)
mat[,i] <- val2
}
df <- as.data.frame(mat) # save example data
ggmice::plot_pattern(df) +
ggplot2::coord_cartesian(expand = FALSE) + # do not make square
ggplot2::geom_raster() # remove grid lines
#> Coordinate system already present. Adding new coordinate system, which will
#> replace the existing one.
Created on 2024-02-01 with reprex v2.1.0
Should also decide on axis titles when breaks are removed.
Status check: discussed edits not all implemented yet, and conflicts with main. Converting to draft.
Based on #131. However, it does not solve the example.