繁体   English   中英

ggplot图例键颜色和透明度

[英]ggplot legend key color and transparency

我正在绘制多条线,它们是透明的。 但是,我不希望图例颜色具有任何透明度。 我尝试了override.aes但没有成功。 这与this question类似,但本质上相反。

目前我有这个

# plot all the lines
plt <- ggplot(dt_plot,aes(x = x, y = mean_change, color = model)) +
        geom_line(aes(group = interaction(model, boot)), alpha = 0.3) +
        xlab('houses/acre') + 
        ylab('change in % prevalance') +
        scale_colour_manual(values=cbbPalette) + 
        theme_few()  + 
        theme(text=element_text(size=10),legend.title = element_blank()) + 
        guides(fill = guide_legend(override.aes= list(alpha = 1)))

透明线条和透明图例颜色

干杯

除了一个小问题外,您的方法非常好:您需要

guides(color = guide_legend(override.aes = list(alpha = 1)))

相反,因为geom_line没有fill美感。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM