我有一个问题的颜色的轮廓的酒吧,我试图添加一个黑色的轮廓,它仍然出现相同的,我试图使一个类似的图形与ggplot2,但mekko库是一个最适合它,我试图添加函数。geom_bar()
或geom_col()
例如geom_bar(stat = "identity", position = "fill", color = "black")
,但没有变化。
library(ggpubr)
library(gridExtra)
library(egg)
library(mekko)
library(lemon)
library(ggh4x)
plotq<- data.frame(product = c(51.7,65.5,6.9, 27.6,13.8),
profit_margin = c(24.6, 70.2,1.3 ,1.3, 0.5),
D= c(32.8,33.6,2.6,12.1,5.2),
revenue = c(51.7,65.5,6.9, 27.6,13.8))
NUMER <- barmekko(plotq, product, profit_margin,revenue) +
scale_fill_manual(values = c("#8DFF47","#FF9BB1","#FF974C","#F1FF54","#BFFAFF"))+
scale_y_continuous(expand = expansion(mult = c(0, 0.5))) +
theme_bw()+
theme(axis.title.x = element_blank(), axis.text.x = element_blank()) +
theme(axis.ticks.length.x = unit(0, "cm")) +
theme(plot.margin = unit(c(0,0,0,0), "cm"))
GRAVIM <- barmekko(plotq, product, D,revenue)+
scale_fill_manual(values = c("#8DFF47","#FF9BB1","#FF974C","#F1FF54","#BFFAFF"))+
scale_y_reverse(expand = expansion(mult = c(0.5, 0))) +
theme_bw() + theme(legend.position = "none") +
theme(plot.margin = unit(c(0,0,0,0), "cm"))
ggarrange(NUMER, GRAVIM, nrow = 2)
字符串
的数据
1条答案
按热度按时间thtygnil1#
由于
barmekko()
函数不允许任何自定义,因此可以直接操作返回的ggplot
对象来添加黑色轮廓,如下所示:字符串
的数据