Maryamghajar
Maryamghajar

Reputation: 5

multiple groups-boxplot-R

I have a CSV file with 3 levels of the parameter(C, C+Fe, Fe). Now I want to group the boxplot based on parameters by using geom-boxplot(fill=parameter) but only for two levels of them, not all 3.

The current code is: geom_boxplot(aes(x = gene, y=RA, fill = parameter) which yealds to: enter image description here

However, I want to eliminate the blue box plot which is one of the parameters.

Upvotes: 0

Views: 246

Answers (1)

Claudio
Claudio

Reputation: 1528

You may just filter the observation before plotting. Assuming your data frame is called df:

df2 <- subset(df, parameter != "Fe")
ggplot(df2, aes(x = gene, y=RA, fill=parameter)) +
  geom_boxplot()

Upvotes: 1

Related Questions