Home > Back-end >  Plotting species and amount against over a certain distance
Plotting species and amount against over a certain distance

Time:09-26

So first of all I am very very new to R. I have walked 50m and counting species I have seen in 5m intervals. Each individual has been given a value in meters according to where they were found. Now I am trying to plot the number of species found against the distance but in the plot, I want to create individual colored dots grouped by species recorded as well.

First, I counted how many times each species was recorded

count <- intidal %>%  
  count(Animal)

And i tried creating the plot with:

ggplot(intidal, aes(x=Distance, y=intidal %>% count(Animal)))   
  geom_point(aes(col=Animal))   
  geom_smooth(method="loess", se=F)   xlim(c(0, 0.1))   ylim(c(0, 500000))   
  labs(title="Species along line transect", y="Number of species", x="Distance")

But I get the error code: "Error: Aesthetics must be either length 1 or the same as the data (512)" and I am just not sure how to work around this, or if anyone has tips to what I should do differently.

Animals over Distance

  • Related