-1

How can I set stat_y_continous in ggplot with min and max values of my variable and specific breaks? I have tried this, but I got an error ("Error in seq.default(min(df$NO3), max(df$NO3), by = 2) : 'from' must be a finite number"):

p + scale_y_continuous(limits = c(min(df$NO3),max(df$NO3)),
               breaks=seq(min(df$NO3),max(df$NO3),by=2))
AUS85
  • 173
  • 2
  • 7
  • 2
    What is the output of `min(df$NO3)` and `max(df$NO3)` ? Have you tried adding `, na.rm=TRUE` in `min` and `max` functions? – Yacine Hajji Aug 23 '23 at 15:26
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Aug 23 '23 at 15:30

0 Answers0