【发布时间】:2021-05-28 19:58:57
【问题描述】:
使用 geom_spoke 绘图时,当 x 和 y 轴的范围差异很大时, 辐条的半径在各个角度上并不均匀。
df <- expand.grid(x = 1:10, y=seq(10, 100, by=10))
df$angle <- seq(from=-pi, to=pi, length.out=10)
ggplot(df, aes(x, y)) +
geom_point() +
geom_spoke(aes(angle = angle), radius = 0.5)
df <- expand.grid(x = 1:10, y=seq(10, 100, by=10))
df$angle <- seq(from=-pi, to=pi, length.out=10)
ggplot(df, aes(x, y)) +
geom_point() +
geom_spoke(aes(angle = angle), radius = 0.5) +
coord_equal(ratio=1)
使用 coord_equal(ratio=1) 使辐条的长度相同,但使绘图不可读。有解决办法吗?
【问题讨论】:
标签: r ggplot2 plot visualization