【发布时间】:2018-05-12 21:42:59
【问题描述】:
我有时会这样做,但我无法找到解决方案。我有这段代码可以使用 R 中的 ggplot2 在 25 x 25 网格上绘制同心圆。我不知道如何能够操纵同心圆的中心不在原点(0,0),而是在中心网格 (5,5)。我也想将网格的比例保持在 25 到 25 之间。非常感谢您提前
require(ggplot2)
require(grid)
x <- rep(seq(25), 25)
y <- rep(seq(25), each=25)
circ_rads <- seq(1,5,2)
qplot(x, y) +
lapply(circ_rads, FUN = function(x)
annotation_custom(circleGrob(gp = gpar(fill = "transparent", color = "black")),
-x, x, -x, x)) +
geom_text(aes(x = 0, y = circ_rads + 0.1, label = circ_rads)) +
coord_fixed(ratio = 1)
【问题讨论】: