[英]Bar plot with polar coordinates, adjust for tapering in ggplot
您可以使用线段代替条形图。 然后,厚度将取决于您选择的尺寸,而不是坐标系:
# sample dataset
set.seed(333)
n.dim = 9
df <- data.frame(
x = paste("attribute", seq(1, n.dim), sep = "."),
score = rnorm(n.dim)
)
ggplot(df,
aes(x = x, y = score,
xend = x, yend = 0,
col = score >= 0)) +
geom_segment(size = 15) + # adjust size for different bar thickness
scale_y_continuous(expand = c(0.1, 0)) + # increase space at plot centre
coord_polar() +
theme_minimal() +
theme(legend.position = "none",
axis.title = element_blank(),
axis.text.y = element_blank(),
panel.grid.major.x = element_blank())
我认为多边形网格(而不是圆形网格)将更难以解释,因为距绘图中心的距离不再与y轴值具有一对一的关系。 (请参见下面的插图)可能有可能破解ggplot中类似于多边形网格的内容,但是我自己还没有看到任何这种实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.