add 'grid' argument for plot_pattern, plot_pred, and plot_corr#135
Draft
pepijnvink wants to merge 3 commits intoamices:mainfrom
Draft
add 'grid' argument for plot_pattern, plot_pred, and plot_corr#135pepijnvink wants to merge 3 commits intoamices:mainfrom
pepijnvink wants to merge 3 commits intoamices:mainfrom
Conversation
Member
|
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) |
Collaborator
Author
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 |
Collaborator
Author
|
Should also decide on axis titles when breaks are removed. |
Instead of `ggplot2::geom_tile`. Avoids awkward coloring with many tiles.
Member
|
Status check: discussed edits not all implemented yet, and conflicts with main. Converting to draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Based on #131. However, it does not solve the example.