Search code examples
rggplot2axis-labels

Is there away to remove increment labels on the y axis in ggplot2?


I am plotting three years of data on a scatterplot in ggplot2, with years as the y-axis. The axis is scaling so that the tick mark labels are "2015.5, 2016, 2016.5 … etc." and I need them to just be "2016 2017 2018". I have tried to use the scale_y_discrete function.

Here is my code

x <- (plot <- ggplot(NULL, aes(sos, year)) + 
  geom_jitter(data = epic, aes(col = "EPIC")) +
  geom_jitter(data = landsat, aes(col = "Landsat")) +
  geom_jitter(data = pheno, aes(col = "PhenoCam")))
x + labs(title = "Start of Season Comparison",
       x = "DOY",
       y = "Year")

and here is the current scatterplot

Thank you!


Solution

  • Have you checked to see the year variable is numeric ? If that is numeric then I think Solorzanos solutions should work