ggplot传说键颜色和透明度

问题描述 投票:1回答:1

我绘制多行在一起,它们是透明的。不过,我不希望传奇色彩有任何透明度。我尝试的override.aes但没有成功。这是类似于此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)))

transparent lines and transparent legend colors

干杯

r ggplot2 transparency legend aesthetics
1个回答
1
投票

你的做法是除了一个小问题完全没有问题:你需要

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

不是作为geom_line没有fill美感。

© www.soinside.com 2019 - 2024. All rights reserved.