0

as mentioned above, I have the following problem:

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

I'm quite new to R, so I'm not sure what is wrong. If anyone has any input on what I need to change, that would be great!

AvgPadCount <- ggplot(APD) +
  aes(x = Species, y = mean, fill = Plot.Type) + 
  geom_col(position = "dodge") +
  geom_errorbar(aes(x = Species, ymin = mean - se, ymax = mean + se), position = position_dodge(0.9), width = 0.2, colour="gray0", alpha=0.9, size=1.3) +
  geom_text(label = c("A", "A", "B", "B"), position = position_dodge(0.9), aes(y = mean+se, x = Species), vjust = -0.5, size = 6) + 
  ylim(0,6) +
  ggtitle("Plot Size Effect on Average Pad Count") +
  xlab("Species") +
  ylab("Average Pad Count per Plant")

MaxClumpHeight <- ggplot(MCH) +
  aes(x = Species, y = mean, fill = Plot.Type) +
  geom_col(position = "dodge") +
  geom_errorbar(aes(x = Species, ymin = mean - se, ymax = mean + se), position = position_dodge(0.9), width =0.2, colour="gray0", alpha=0.9, size=1.3) + 
  geom_text(label = c("A", "A", "B", "C"), position = position_dodge(0.9), aes(y = mean+se, x = Species), vjust = -0.5, size = 6) +
  ylim(0,32) +
  ggtitle("Plot Size Effect on Max Clump Height") +
  xlab("Species") +
  ylab("Mean Max Clump Height (cm)")

AvgPadCount
MaxClumpHeight
Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
TCK
  • 1
  • Hi TCK. To help us to help you could you please make your issue reproducible by sharing a sample of your **data**? See [how to make a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – stefan Dec 13 '20 at 23:11
  • From the error message it's clear that at least one of your datasets contains five observations while you only provide a vector of four labels. That's what the error message is telling you. – stefan Dec 13 '20 at 23:13

0 Answers0