99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2019-03-10 閱讀量: 1645
用ggplot繪制餅圖

library(dplyr)

library(ggplot2)

library(ggmap) # 為了引用主題theme_nothing,用來消除原始ggplot繪圖自帶的一切標簽

df <- data.frame(value = c(52, 239, 9),

Group = c("Positive", "Negative", "Neutral")) %>%

# factor levels need to be the opposite order of the cumulative sum of the values

mutate(Group = factor(Group, levels = c("Neutral", "Negative", "Positive")),

cumulative = cumsum(value),

midpoint = cumulative - value / 2,

label = paste0(Group, " ", round(value / sum(value) * 100, 1), "%"))

ggplot(df, aes(x = 1, weight = value, fill = Group)) +

geom_bar(width = 1, position = "stack") +

coord_polar(theta = "y") ## 以y軸建立極坐標

+

geom_text(aes(x = 1.3, y = midpoint, label = label)) ## 加上百分比標簽的位置和數(shù)值

+

theme_nothing()

27.2058
4
關(guān)注作者
收藏
評論(0)

發(fā)表評論

暫無數(shù)據(jù)
推薦帖子