on-internet
← Community

Remove legend entries for some factors levels

Stack Overflow ·

Is it possible to remove legend elements corresponding to certain factor levels? In my example, I wish to remove legend entries for the grey factor levels (1-5), and only keep the levels "Best", "Suggested", and "Worst". I have tried a number of hacks already, but most of them have either removed the grey coloring of the bars (in groups of 25 each) or only left me with the bars that I colored red, yellow, and green. # ggplot2 barplot <- ggplot(training_results.barplot, mapping=aes(x=name, fill=factor(a))) # filling based on a column ##mapping=aes(x=name, fill=factor(a)) barplot <- barplot + ge

Comments

Sign in or sign up to comment and upvote.

No comments yet.