Stackoverflow community,
I currently have a problem using plotnine in python. My code is the following:
from plotnine import *
from plotnine.data import mpg
%matplotlib inline
plot = (ggplot(result) +
aes(x = 'age', y = 'fa index', color='ID') +
geom_point(size = 2) +
geom_path() +
stat_smooth(method='lm') +
aes(group = 'Trained_yung') + #line of best fit by group
ylab("FA index") +
xlab("Age (days)") +
theme_bw())
plot.save('filename.pdf', height=8, width=8)
"result" being the pandas dataframe with my results.
If remove stat_smooth:
plot = (ggplot(result) +
aes(x = 'age', y = 'fa index', color='ID') +
geom_point(size = 2) +
geom_path() +
ylab("FA index") +
xlab("Age (days)") +
theme_bw())
plot.save('filename.pdf', height=8, width=8)
I have got:
so I deduced that stat_smooth added these weird links between my points