import numpy as np
import pandas as pd
n = 11
x = np.linspace(0, 2, n)
y = np.sin(2 * np.pi * x)
y2 = np.cos(2 * np.pi * x)
df = pd.DataFrame({'x': np.append(x, x), 'y': np.append(y, y2), 'class': np
    .append(np.repeat('sin', n), np.repeat('cos', n))})
g = sns.factorplot(x='x', y='y', hue='class', palette=graycolors, data=df,
    linestyles=['-', '--'], markers=['o', 'v'], legend=False)
g.axes[0][0].legend(loc=1)
plt.show()
Python Seaborn Matplotlib setting line style as legend