# Path: graphics_utils.py
# def initialize_graphics():
#     rcParams.update({'figure.autolayout': True})
#     rc('text', usetex=True)
#     # Configure palette and plotting to pgf/tikz
#     sns.set(style="nogrid")
#     return sns.color_palette("colorblind")    
# 
# def cm2inch(tupl):
#     """Helper function to convert centimeters to inches.
#     """
#     return tuple(i/2.54 for i in tupl)


import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Circle
from numpy.random import rand
from graphics_utils import initialize_graphics, cm2inch


x = rand(40)-0.5
z = x+0.4
y = z+rand(40)/2+0.3
w = z-rand(40)/2-0.3

xx = np.arange(-0.8,0.8,0.01)
yy = xx+0.4

margin_one = xx+0.4+0.2
margin_two = xx+0.4-0.2

colors = initialize_graphics()

fig, ax = plt.subplots()
fig.set_size_inches(cm2inch([10,10]))
plt.plot(x, y, 'D' , color=colors[0], label='Class 1')
plt.plot(x, w, 's', color=colors[1], label='Class 2')
plt.plot(xx, yy, color=colors[2], linewidth=4, label='Decision\n surface')
plt.plot(xx, margin_one, '--', color=colors[2], linewidth=2, label='Margin')

# Path: graphics_utils.py
# def initialize_graphics():
#     rcParams.update({'figure.autolayout': True})
#     rc('text', usetex=True)
#     # Configure palette and plotting to pgf/tikz
#     sns.set(style="nogrid")
#     return sns.color_palette("colorblind")    
# 
# def cm2inch(tupl):
#     """Helper function to convert centimeters to inches.
#     """
#     return tuple(i/2.54 for i in tupl)


# Path: support_vectors.py
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Circle
from numpy.random import rand
from graphics_utils import initialize_graphics, cm2inch



x = rand(40)-0.5
z = x+0.4
y = z+rand(40)/2+0.3
w = z-rand(40)/2-0.3

xx = np.arange(-0.8,0.8,0.01)
yy = xx+0.4

margin_one = xx+0.4+0.2
margin_two = xx+0.4-0.2

colors = initialize_graphics()

fig, ax = plt.subplots()
fig.set_size_inches(cm2inch([10,10]))
plt.plot(x, y, 'D' , color=colors[0], label='Class 1')
plt.plot(x, w, 's', color=colors[1], label='Class 2')
plt.plot(xx, yy, color=colors[2], linewidth=4, label='Decision\n surface')
plt.plot(xx, margin_one, '--', color=colors[2], linewidth=2, label='Margin')

plt.plot(xx, margin_two, '--', color=colors[2], linewidth=2)