作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 8 个图,我想将它们全部绘制在一页上。每个图都是使用基础图形制作的,我宁愿坚持使用它而不是使用 lattice
或 ggplot
。
下面的方案是一个页面,其中每个数字表示哪个图 # 占据了该页面的比例。有什么方法可以用 layout
或任何其他基本函数来做到这一点吗?
1111122
3333444
5556666
7788888
我目前的一些代码:
pdf("test.pdf",height=30,width=10)
widths = c(5/7,2/7,4/7,3/7,3/7,4/7,2/7 5/7) # this doesn't work
x=layout(matrix(1:8,nrow=4,ncol=2,byrow=T), widths=widths,
heights=rep(1/4,4))
for (ix in 1:4){
plot(rnorm(100))
plot(rnorm(100))
}
dev.off()
最佳答案
您可以为布局指定矩阵并使用layout
函数。
mat <- t(sapply(1:4, function(x)
rep.int(c((x - 1) * 2 + 1, (x - 1) * 2 + 2), c(6 - x, 1 + x))))
# [,1] [,2] [,3] [,4] [,5] [,6] [,7]
# [1,] 1 1 1 1 1 2 2
# [2,] 3 3 3 3 4 4 4
# [3,] 5 5 5 6 6 6 6
# [4,] 7 7 8 8 8 8 8
layout(mat)
for (i in 1:8) {
plot(rnorm(10))
}
如果相同的数字在布局矩阵中重复出现,则绘图使用与该数字对应的空间。
关于r - 如何在 R 中使用布局调整行宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28415039/
我最近开始使用无表格 CSS 编写我所有的布局,但仍然更喜欢旧表格样式。快多了。无论如何,我陷入了这个即将完成的布局,但我需要一个小细节的帮助,我无法修复。 这里是测试地址: http://www.s
我正在尝试将节点形状的大小调整为节点文本的大小。我按照 https://github.com/cytoscape/cytoscape.js/issues/649 的指示进行操作。但是: 形状始终以高度
我是一名优秀的程序员,十分优秀!