0

Here is the code. I am missing a 2008 year if you look at the picture of my plot provided.enter image description here

ggplot(avg_years_location, aes(x = year, y = avg.wood.found,
                      color = location.name)) +
  geom_point() +
  theme_classic() +
  xlab("Year") +
  ylab("Average Number of Wood Ticks Found") +
  guides(col = guide_legend(title = "Location Name")) +
  scale_x_continuous(labels = as.character(avg_years$year), 
                     breaks = avg_years$year) +
                    expand_limits(y = c(0, 4)) +
theme(axis.text.x = element_text(angle = 90),
      plot.title = element_text(size = 15, face = "bold"),
      legend.title = element_text(size=15),
      legend.text = element_text(size=12)) +
      ggtitle("Average Number of Harvard Forest\nWood Ticks Found Per Year")
stefan
  • 90,330
  • 6
  • 25
  • 51
Maria
  • 11
  • 2
  • Welcome to SO! It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. – stefan May 03 '22 at 06:55
  • This said: I would suggest to check `avg_years$year`. From the image you posted I would guess that this vector is missing the year 2008 as there is no tick mark for this year. – stefan May 03 '22 at 06:58

0 Answers0