我想绘制这样的东西(摘自本文) http://wwwconference.org/www2008/papers/pdf/p665-adamic.pdf其中图标(在本例中为小图形)用作刻度标签。
I get this far, where icons are more or less properly placed:
This is the code:
library(igraph)
npoints <- 15
y <- rexp(npoints)
x <- seq(npoints)
par(fig=c(0.05,1,0.3,1), new=FALSE)
plot(y, xlab=NA, xaxt='n', pch=15, cex=2, col="red")
lines(y, col='red', lwd=2)
xspan <- 0.9
xoffset <- (0.07+0.5/npoints)*xspan
for(i in 1:npoints){
x1 <- (xoffset+(i-1)/npoints)*xspan
x2 <- min(xspan*(xoffset+(i)/npoints),1)
par(fig=c(x1,x2,0,0.5), new=TRUE)
plot(graph.ring(i), vertex.label=NA)
}
但是,如果点数增加(例如npoints <- 15
)它抱怨因为没有地方放置图标:
Error in plot.new() : figure margins too large
我想知道是否有一种更自然的方法来做到这一点,以便它适用于任何(合理的)数量的点。
欢迎任何建议。