I am not getting the equation detail in my plot.
Would you please suggest if any corrections needed to show the Polynomial Equation.
Please note that no error message is showing.
My Codes:
ggplot(Sales, aes(Date, Price))+
geom_point(size=3, shape=16, color = 'green')+
geom_smooth(aes(color = "3rd Order Trend"), method = "lm", formula = y~poly(x,3), se = F) +
coord_cartesian(ylim = c(0, 550)) +
scale_color_manual(values = c("Linear Trend" = "blue", "3rd Order Trend" = "red"), name=NULL) +
stat_regline_equation(
aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")),
formula = y~poly(x,3), se = F
)+
labs(title = "Retail Price Trend", x = "Sale Date", y = "Sales Price/s.f.")
> dput(head(Sales))
structure(list(Date = structure(c(1298937600, 1330560000, 1333238400,
1335830400, 1335830400, 1351728000), tzone = "UTC", class = c("POSIXct",
"POSIXt")), Price = c(47.57, 35.79, 1022.42, 91.27, 67.2, 73.24
)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"
Thank you!