ggplot2绘制饼图

# 加载 ggplot2 包
library(ggplot2)

# 加载数据
data <- data.frame(category = c("A", "B", "C", "D"), value = c(10, 20, 30, 40))

# 绘制饼图
ggplot(data, aes(x = "", y = value, fill = category)) +
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start = 0) +
  theme_void()

  

posted @ 2023-02-11 09:01  bio调参侠  阅读(36)  评论(0编辑  收藏  举报