mice icon indicating copy to clipboard operation
mice copied to clipboard

Is it possible to scale the x-axis in an md.pattern() plot.

Open chamath-perera opened this issue 3 years ago • 6 comments

I have been able to rotate the label names, but would like to scale the x axis to make the numbers readable. Does anyone know if this is possible?

mice 3.3.5 adds the rotate.names argument to md.pattern()

Originally posted by @stefvanbuuren in https://github.com/amices/mice/issues/154#issuecomment-453842762

chamath-perera avatar Jan 18 '21 02:01 chamath-perera

Not a solution, but to circumvent the problem you could use the ggplot code that I've written for a shiny app here: https://github.com/amices/shinyMice/blob/main/shinymice/R/utils_02_model.R

hanneoberman avatar Feb 17 '21 16:02 hanneoberman

How did you rotate the x-axis values? I would also like to do that.

woodwards avatar Aug 31 '22 01:08 woodwards

@woodwards The visualization package ggmice now offers easily adjustable md pattern plots. You could use it from CRAN or look at the source code in this repo?

hanneoberman avatar Aug 31 '22 08:08 hanneoberman

@woodwards I am pretty sure you can try. md.pattern(x, plot = TRUE, rotate.names = TRUE), however as @hanneoberman said the ggmice package might also be suitable.

chamath-perera avatar Aug 31 '22 08:08 chamath-perera

I am using rotate.names, but it only rotated the names on top of the plot, not the numbers on the bottom.

woodwards-dnz avatar Aug 31 '22 21:08 woodwards-dnz

@woodwards-dnz For this you should use ggmice as suggested by @hanneoberman. Please find the vignette here for reference.

You can use the plot pattern function and specify rotate as true.

plot_pattern(dat, square = TRUE, rotate = TRUE)

chamath-perera avatar Aug 31 '22 21:08 chamath-perera

Suggest using ggmice::plot_pattern() as a solution, so am closing.

stefvanbuuren avatar Nov 14 '22 15:11 stefvanbuuren