I'm having the following problem, I'm trying to make a pair plot with GGally and either it comes out too small which makes it useless or it closes if I try to open it in a popup window.
I'm using the breast cancer csv,
# Load csv
data <- read.csv("https://raw.githubusercontent.com/cnahuina/data-mineria/master/breast-cancer.csv")
head(data)
# Graph + convert it to a grob table and store it
g <- ggpairs(data = data, columns = 3:12, ggplot2::aes(colour = diagnosis)) |> ggmatrix_gtable()
# fix the size of your panels:
panel_size <- grid::unit(.5, "cm")
g$widths[grid::unitType(g$widths) == "null"] <- panel_size
g$heights[grid::unitType(g$heights) == "null"] <- panel_size
# Draw grob table using grid functions on windows optim for better view:
windows()
grid::grid.newpage()
grid::grid.draw(g)
grid::unitType(g$widths) == "null" matches nothing, did you mean g$widths[grid::unitType(g$widths) != "null"]
It is so that it takes the settings that are set in panel_size.
What happens to me, which is strange, is that once the window loads, it closes automatically.
no it doesn't because you assign panel size to nothing
You're right, I put it and it's unnecessary, now even if I remove it, it still happens to me that the windows() window closes as soon as it finishes loading.
This works well for me in both RStudio and Positron
library(ggplot2)
library(GGally)
# Load csv
data <- read.csv("https://raw.githubusercontent.com/cnahuina/data-mineria/master/breast-cancer.csv")
head(data)
g <- ggpairs(data = data, columns = 3:12,
ggplot2::aes(colour = diagnosis)) |>
ggmatrix_gtable()
plot(g)
thanks man, that makes the jobs done!