简体   繁体   中英

Change plot size of pairs plot in R

I have this pairs plot

在此处输入图像描述

I want to make this plot bigger, but I don't know how.

I've tried

window.options(width = 800, height = 800)

But nothing changes.

Why?

That thing's huge. I would send it to a pdf.

> pdf(file = "yourPlots.pdf")
> plot(...)  # your plot
> dev.off()  # important!

Also, there is an answer to the window sizing issue in this post .

If your goal is to explore the pairwise relationships between your variables, you could consider using the shiny interface from the pairsD3 R package, which provides a way to interact with (potentially large) scatter plot matrices by selecting a few variables at a time.

An example with the iris data set:

install.packages("pairsD3")
require("pairsD3")
shinypairs(iris)

More reference here

I had the same problem with the pairs() function. Unfortunately, I couldn't find a direct answer to your question.

However, something that could help you is to plot a selected number of variables only. For this, you can either subset the default plot. Refer to this answer I received on a different question.

Alternatively, you can use the pairs2 function which I came across through this post .

To make the plot bigger, write it to a file. I found that a PDF file works well for this. If you use "?pdf", you will see that it comes with height and width options. For something this big, I suggest 6000 (pixels) for both the height and width. For example:

pdf("pairs.pdf", height=6000, width=6000)
pairs(my_data, cex=0.05)
dev.off()

The "cex=0.05" is to handle a second issue here: The points in the array of scatter plots are way too big. This will make them small enough to show the arrangements in the embedded scatter plots.

The labels not fitting into the diagonal boxes is resolved by the increased plot size. It could also be handled by changing the font size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM