S
Swetha Shetty

Posted on 29th March 2024|349 views

0
votes

Aesthetics Must Be Either Length 1 Or The Same As The Data

How to resolve the Error: Aesthetics must be either length 1 or the same as the data (2): fill?

I have a code like

> b <- ggplot(data= yield2016_drought7,aes_string(x = "Condition", y = "FT"))

> b+ geom_boxplot(notch = T, fill = c("yellow", "orange", "red", "pink"), outlier.color = NULL) + ggtitle("Flowering Time") + theme(legend.position = "none") + theme_classic()

Error: Aesthetics must be either length 1 or the same as the data (1): fill

 

Answers
P
Anusha V

Posted on 29th March 2024

Try this:

ggplot(data = yield2016_drought7, aes_string(x = "some_Condition", y = "FT")) + 

  geom_boxplot()

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos