美文网首页R语言做图
ggplot2绘制梯形条形图

ggplot2绘制梯形条形图

作者: R语言数据分析指南 | 来源:发表于2021-07-05 22:36 被阅读0次
library(ggplot2)

positions <- data.frame(
  id = rep("glass", each = 4),
  x = c(3.5,4.5,3,5),
  y = c(1,1,5,5),
  fill = rep("a")
)

positions

ggplot(positions[c(1,2,4,3),], aes(x = x, y = y)) +
  geom_polygon(aes(fill=fill,group = id))+
  theme_classic()+
  theme(legend.position="non")+
  labs(x=NULL,y=NULL)+
  scale_fill_brewer(palette="Blues")

相关文章

网友评论

    本文标题:ggplot2绘制梯形条形图

    本文链接:https://www.haomeiwen.com/subject/qdbbultx.html