如何具体更改小节中图例的顺序?

时间:2020-03-23 10:51:37

标签: r ggplot2 package bar-chart legend

enter image description here

ggplot() + 
  geom_bar(data = plotDf,
           aes(x = reorder(plotDf$sample_id), y = counts, fill = condition), 
           stat = 'identity') + 
labs(x = 'Sample') + 
theme_bw() +
theme(axis.text.x = element_text(angle = 90))+ 
scale_fill_manual (values = cbPalette)

大家好,

以上是我的代码和barplot。我想将示例和图例的顺序更改为'wt'wt_dia'wt_afn','wt_2mut','wt_1mut',与我的dataframe(plotDf)中的相同。但是这里显然是按字母顺序显示的。非常感谢!

0 个答案:

没有答案
相关问题