在R中打印igraph对象时控制轴标签大小
在R中绘制igraph生成的网络时,是否有可能控制轴标签的字体大小? 与包网络相反,cex.lab在传递到“plot”时不会更改任何内容 例如:在R中打印igraph对象时控制轴标签大小,r,plot,visualization,igraph,R,Plot,Visualization,Igraph,在R中绘制igraph生成的网络时,是否有可能控制轴标签的字体大小? 与包网络相反,cex.lab在传递到“plot”时不会更改任何内容 例如: library(igraph) testnet <- graph_from_adjacency_matrix(diag(10)) plot(testnet,xlab="This is xlab Text") par(mfrow=c(2,3)) replicate(6,plot(testnet,xlab="This is xlab Text
library(igraph)
testnet <- graph_from_adjacency_matrix(diag(10))
plot(testnet,xlab="This is xlab Text")
par(mfrow=c(2,3))
replicate(6,plot(testnet,xlab="This is xlab Text"))
replicate(6,plot(testnet,xlab="This is xlab Text",cex.lab=10))
如果一页上有多个绘图,默认字体大小太小
请注意,我不是说设置顶点标签vertex.label.cex的大小。这是解决问题的一种方法,即使它不是问题的解决方案。获得所需内容的一种可能性是省略x标签,并在绘图下方添加可自定义的文本
par(mfrow=c(1,2))
# plot with x-axis label
plot(graph_from_adjacency_matrix(diag(10)), xlab = "mylab")
# plot w/o x-axis label + text
plot(graph_from_adjacency_matrix(diag(10)))
text(0, -1.8, labels = "myxlab", cex = 2.5)
这可能是你的结果。
另一种选择:将标签的大小添加到PAR中。 一个大小适用于所有绘图
rr <- 2; cc <- 3
par(mfrow=c(rr,cc), cex.lab=1.5)
replicate(6,plot(testnet,xlab="This is xlab Text"))
绘图的不同大小:
par(mfrow = c(rr,cc))
plot.new()
cex.labs <- matrix(runif(2*3, 1, 3), ncol=cc, nrow=rr)
for (x in seq_len(rr))
for (y in seq_len(cc)) {
par(mfg=c(x,y), cex.lab = cex.labs[x,y])
plot(testnet,xlab="This is xlab Text")
}
非常感谢。将标签大小添加到PAR中的工作是完美的,谢谢,这是一个很好的解决办法,但是公认的答案直接解决了这个问题。