简体   繁体   中英

How to change plot size in R?

I would like to create two plots side-by-side, but the problem I am running into is that R seemingly can not enlarge the "plotting space", which results in shrinkage of both graphs on the x-axis like so: 在此处输入图像描述

You can also see that the line names also get cropped due to not enough space being present. Sow the question is: how do I make the plots wider and the labels fully visible? It would be great to avoid any libraries like ggplot , but if there is no other way, this will be fine as well.

Here is how the plots above are constructed:

layout(matrix(c(1,2), 1, 2, byrow = TRUE))  
plot(plot1)
plot(plot2) # axis(4, at = coef1[nrow(coef1), ], labels = colnames(coef1), cex = 0.8, adj = 0, las=2) 

You can open a graphics device, such as x11() , windows() or cairo() setting the width and height. This will automatically resize the plot regions. In the example that follows, making them larger.

x11(width = 20, height = 4)
layout(matrix(c(1,2), 1, 2, byrow = TRUE))  
plot(1:10)
plot(-(1:10))

As for the margins, see help("par") , entries for oma and mar .

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