Home > Software design >  Groups with fewer than two data points have been dropped
Groups with fewer than two data points have been dropped

Time:03-31

I'm trying to create a violin plot on a rocky shore survey, exposed vs sheltered. I keep have groups deleted that I need.

# Violin plot

P5s <- ggplot(Example_data, aes(x=Species, y=Mean_perc), font="calibri") 
  geom_violin()
P5s

# Violin plot with difference between sheltered and exposed side

P6se <- ggplot(data, aes(x=Species, y=Mean_perc, fill=Location), font="calibri") 
  geom_violin() 
  scale_fill_discrete(labels=c("Exposed","Sheltered")) 
  theme(axis.text.x = element_text(angle=90, vjust= 0.5))
P6se

I have my data set: enter image description here

# Violin plot with difference between sheltered and exposed side

P6se <- ggplot(Example_data, aes(x=Species, y=Mean_perc, fill=Location), font="calibri") 
  geom_violin()  
  geom_point(data = filter(Example_data, Species_loc_n == 1), aes(color = Location), show.legend = FALSE)  
  scale_fill_discrete(labels=c("Exposed","Sheltered")) 
  theme(axis.text.x = element_text(angle=90, vjust= 0.5))
P6se

enter image description here

Violins might not be the best choice for these data, though. I would try it with boxplots, or maybe just a simple scatterplot.

  • Related