【发布时间】:2019-11-27 23:34:33
【问题描述】:
美好的一天。我在 R 中使用了很多 ggplot。我缺少一些关于如何在ggplot 中制作饼图的基本知识。我想为变量puls$reykir 制作一个饼图,并在图表上显示百分比。下面的代码似乎画了一个饼图,但标签很奇怪。如何更改代码以便用正确位置的百分比替换奇怪的标签?这是我的代码:
puls <- read.table ("https://edbook.hi.is/gogn/pulsAll.csv", header=TRUE, sep=";")
ggplot(puls, aes(x = "", y = reykir, fill = reykir)) +
geom_bar(stat = "identity") +
coord_polar(theta = "y", start = 0, direction = 1)
【问题讨论】: