How do I display only selected items in a ggplot2

2020-04-14 12:28发布

I'm creating a stacked bar plot of relative abundance data, but I only want to display the ten most abundant organisms in the legend. How do I do this? I have no idea where to begin and haven't found any answers online.

Here's the plot with a full legend:

enter image description here

Thanks.

标签: r ggplot2 legend
1条回答
The star\"
2楼-- · 2020-04-14 12:50

As pointed out by user20650 in the comments, the answer is to add a list of selected items to the breaks= argument in scale_fill_manual()

scale_fill_manual(breaks=list,values=colpal)

查看更多
登录 后发表回答