1

I am doing a linear regression on a few timeseries (different colors) and plotting the equation on the same graph. In R using ggplot and ggpubr this is very easy. here is the example and the output:

library(tidyverse)
library(ggpubr)
economics_long %>%
  ggplot(aes(date, value01, color = variable)) + 
  geom_line() + 
  theme_light() + 
  geom_smooth(method = "lm", se = F) +
  stat_regline_equation(aes(label =  paste(..eq.label.., ..rr.label.., sep = "~~~~")))

enter image description here

Is there a way to do this in python / seaborn without having to do the fit for each colour and making the equations by hand?

If not seaborn, which python charting package allow us to do this easily? plotly, plotnine?

Courvoisier
  • 904
  • 12
  • 26

0 Answers0