Tom*_*gan 4 transparency r legend ggplot2 aesthetics
我正在绘制多条线,它们是透明的。但是,我不希望图例颜色具有任何透明度。我尝试了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)))
Run Code Online (Sandbox Code Playgroud)
干杯
除了一个小问题外,您的方法非常好:您需要
guides(color = guide_legend(override.aes = list(alpha = 1)))
Run Code Online (Sandbox Code Playgroud)
相反,因为geom_line没有fill美感。