1

如何grid.yaxis()在以下网格图中正确旋转 y 轴的标签(使用 创建)?注释掉的想法可以在 Paul Murrell 的书中找到,但由于某种原因它失败了。一个有效的版本grid.edit("yaxis1", edits=gEdit("labels", rot=90))如下所示,但是标签不再正确地居中于刻度线......

require(grid)

X <- matrix(rexp(2000), ncol=2)

grid.newpage()
pushViewport(plotViewport(c(4,4,4,4)))
pushViewport(dataViewport(X[,1], X[,2]))
grid.points(X[,1], X[,2], pch=1)
grid.rect()
grid.xaxis()
grid.yaxis(name="yaxis1")
grid.edit("yaxis1", edits=gEdit("labels", rot=90))
#grid.edit("yaxis1::labels", rot=90) # => fails with "Error in editDLfromGPat(hgPath, specs, strict, grep, global, redraw) : 'gPath' (yaxis1::labels) not found"
upViewport()
4

0 回答 0