I am trying to introduce a custom equation to my ggplot.
data1989 %>%
ggplot(aes(x = daysAFTERFIRE, y = NDVI)) +
stat_function(fun= ~ (.meanNDVI)-(exp(-0.0000348*(.x)-2.17)))
As you see, my custom equation includes both y (column NDVI) and x (column daysAFTERFIRE), but also a third term, meanNDVI which is another column on my tibble.
Trying to run I get this:
Computation failed in `stat_function()`:
object '.meanNDVI' not found
Anyone has any idea to solve this? Thanks!