Sure, you can define xlim()
. Add:
+ xlim('Ideal', 'Premium', 'Very Good')
Edit after @Arun comments below: A more direct approach would be to subset the data before you feed it to ggplot()
. You can use data.table
's features to make this very fast
setkey(diamonds, cut) ## needed for fast subsetting and grouping
tt <- diamonds[, list(count=.N), by=cut] ## same as table(diamonds$cut) but faster
cut.values <- tt[order(count), cut][1:3] ## select top 3 cut values by count
ggplot(diamonds[J(cut.values)], ... ## run the same plot commands on subset of data