import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from mpl_ornaments.titles import set_title_and_subtitle

fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(5,6))

#1
df = pd.read_csv('data/iris.csv', comment='#')
 
#2
sns.regplot(data=df, x='SepalLengthCm', y='PetalLengthCm', 
            scatter_kws={'linewidths':0.5,'edgecolor':'black'}, 
            ci=95, ax=ax)

ax.set_xlabel('Sepal length [cm]')
ax.set_ylabel('Petal length [cm]')
ax.spines[['right', 'top']].set_visible(False)
ax.axis('equal')

title = 'Iris sepal length vs. petal length'
subtitle = ('Source: The Iris Dataset. UCI Machine Learning Repository '
            '(via Kaggle)')
set_title_and_subtitle(fig=fig, title=title, alignment='left',
                       subtitle=subtitle)

fig.savefig('charts/scatter-plot-with-regline.png', dpi=300,
            bbox_inches='tight')