%matplotlib inline
from stemgraphic.num import stem_graphic
import pandas as pd
import numpy as np
import math

"""
Explanation: Back-to-back Stem-and-Leaf with numbers
End of explanation
"""


df = pd.read_csv('../datasets/iris.csv')

df.describe()

fig, ax = stem_graphic(df['sepal_length'],
                       random_state=42,
                       title='sepal_length')

fig, ax = stem_graphic(df['sepal_width'],
                       random_state=42,
                       mirror=True,
                       title='sepal_width')

"""
Explanation: Loading the iris dataset
End of explanation
"""


fig, ax = stem_graphic(df['sepal_length'],
                       df['sepal_width'],
                       random_state=42,
                       legend_pos=None, outliers=True)

"""
Explanation: Let's combined both variables in one back-to-back stem-and-leaf plot:
End of explanation
"""


fig, ax = stem_graphic(df['sepal_width'],
                       df['sepal_length'],
                       random_state=42,
                       legend_pos=None)

"""
Explanation: And of course, we can save a pdf. Note the option needed:
fig.savefig('b2b_stem_graphic_numbers.pdf', bbox_inches='tight')
Inverting the two variables, we get
End of explanation
"""


