作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我用下一个代码在 R 中制作了一个饼图:
#make slices
slices <- c(19, 26, 55)
# Define some colors
colors <- c("yellow2","olivedrab3","orangered3")
# Calculate the percentage for each day, rounded to one decimal place
slices_labels <- round(slices/sum(slices) * 100, 1)
# Concatenate a '%' char after each value
slices_labels <- paste(slices_labels, "%", sep="")
# Create a pie chart with defined heading and custom colors and labels
pie(slices, main="Sum", col=colors, labels=slices_labels, cex=0.8)
# Create a legend at the right
legend("topright", c("DH","UT","AM"), cex=0.7, fill=colors)
legend("centreright", c("DH","UT","AM"), cex=0.7, fill=colors)
.
最佳答案
你可以玩x
和 y
来自 legend
的争论(参见 ?legend
):
legend(.9, .1, c("DH","UT","AM"), cex = 0.7, fill = colors)
关于r - 如何在 R 中的饼图旁边制作图例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37206472/
我是一名优秀的程序员,十分优秀!