
[英]Adding a vertical line to plotly plot using plotlyProxyInvoke without resizing the plot
[英]Show/plot images without resizing
我想用自定义分辨率在R中绘制几个图像。
例:
par(mfrow=c(1,2))
image(1:4,1:4,matrix(0,4,4))
image(1:2,1:2,matrix(1,2,2))
而不是所有具有相同尺寸(分辨率)的图像2应该更小但仍然以par
布置。
我研究了ggplot
, image
, layout
和par
并尝试了几个小时没有成功。
尝试使用gridExtra包,例如:
library(gridExtra)
library(ggplot2)
p1 <- ggplot() +
geom_rect(aes(xmin = 0, xmax = 4, ymin = 0, ymax = 4), color = "red", fill = "red")
p2 <- ggplot() +
geom_rect(aes(xmin = 0, xmax = 2, ymin = 0, ymax = 2), color = "orange", fill = "orange")
lay <- rbind(c(1, 1, 1, 1, NA, NA),
c(1, 1, 1, 1, NA, NA),
c(1, 1, 1, 1, 2, 2),
c(1, 1, 1, 1, 2, 2))
grid.arrange(p1, p2, layout_matrix = lay)
这是一个很好的资源: https : //cran.r-project.org/web/packages/gridExtra/vignettes/arrangeGrob.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.