带有其他细条的堆叠条形图,以显示百分比条

时间:2019-09-18 17:28:45

标签: ggplot2 r-plotly

我需要一些帮助。我想制作此数据按行堆叠的堆叠条形图,即需要将行CM和CRD堆叠在一起,并在条形图内显示绘制值,在细条形图和主条形图之间分别表示我单独提供的百分比值但可以包含在main data.table中。带有箭头显示百分比值。

示例:
enter image description here ()

这是我尝试过的:

Text <- c(99, 84,74,42,66,94)

ggplot() + geom_bar(aes(y =hei , x = bx, fill = bx), data = data, color = data$bx ,
                    stat="identity")+ 
  scale_y_continuous(breaks = c( 100000, 200000, 300000, 400000, 500000, 600000, 750000))+
  geom_bar(position = 'dodge', stat='identity') +
  geom_text(aes(x= bx, y= hei, label=bowtie), position=position_dodge(width=0.9), vjust=-0.25)+
  theme(axis.text.x = element_text(angle = 30))

0 个答案:

没有答案