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))

df = pd.read_csv('data/iris.csv', comment='#')

#1
colours, shapes = ['#66c2a5', '#fc8d62', '#8da0cb'], ['o', 's', 'D']

#2
sns.scatterplot(data=df, x='SepalLengthCm', y='PetalWidthCm',
                hue='Species', style='Species', palette=colours,
                markers=shapes, edgecolor='k', linewidth=0.5)

#3
ax.legend(frameon=False)

ax.set_xlabel('Sepal length [cm]')
ax.set_ylabel('Petal width [cm]')
ax.spines[['right', 'top']].set_visible(False)

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, subtitle=subtitle, 
                       alignment='left', h_offset=30, v_offset=15)

fig.savefig('charts/scatter-plot-with-categories.png', dpi=300,
            bbox_inches='tight')