小编xra*_*ash的帖子

ggplot2 geom_text在饼图中的位置

我正在使用 ggplot2 绘制饼图,并成功地将百分比标签集中在每个切片中

library(dplyr) 
library(ggplot2)
library(ggpubr)
library("readxl")
df <- read_excel("Radiocomp.xlsx")

df$Pattern <- factor(cc$Pattern)
str(cc)

GGO <- ggplot(data=df, aes(x = "", y = GGO, fill = Pattern)) +
  geom_bar(stat="identity", color = "white") +
  geom_text(aes(label = paste0(GGO, "%")), position = position_stack(vjust = 0.5)) +
  coord_polar("y") +
  theme_void()

GGO
Run Code Online (Sandbox Code Playgroud)

饼形图

我尝试将百分比标签放在饼图之外以获得更好的可读性

有什么推荐吗?

谢谢

ggplot2 pie-chart geom-text

0
推荐指数
1
解决办法
7054
查看次数

标签 统计

geom-text ×1

ggplot2 ×1

pie-chart ×1