I would like to visualize the selection frame I have got from my data frame df. I can not understand why seaborn seems to have some problems plotting the class named car. In the figure I obtain there are two black dots and a white one referring to this class instead of 3 blue dots as the legend reports. Actually, if I remove this class I get the same problem in another one. Do you know why? Thanks in advance.
Here my code:
import pandas as pd
import numpy as np
import random
from matplotlib import pyplot as plt
import seaborn as sns
np.random.seed(176)
random.seed(16)
df = pd.DataFrame({'class': random.sample(['living room','dining room','kitchen','car','bathroom','office']*10, k=25),
'Amount': np.random.sample(25)*100,
'Year': random.sample(list(range(2010,2018))*50, k=25),
'Month': random.sample(list(range(1,12))*100, k=25)})
frame = pd.pivot_table(df, index=['class','Year'], values=['Amount'], aggfunc=np.sum).reset_index()
yaplot=sns.lmplot(x='Year' , y='Amount', data=frame, hue='class',palette='hls', fit_reg=False,size= 5, aspect=5/3, legend=False,legend_out=False,scatter_kws={'s': 70})
yaplot.ax.legend(loc=2)
sns.plt.ticklabel_format(style='plain', axis='x',useOffset=False)
plt.show()
Here my result:
Here my frame (Sorry for this informal way to share it. I wanted to upload the csv file of it but I just found out it is not possible to do it) :
Up-To-Date:
I get the following warning when I run the code. I did not see it before.
UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter
Actually it makes sense. My code seems to have some problems only when it has to use colors. To avoid it, I added the two lines:
plt.rc('axes', prop_cycle=(cycler('color', ['b', 'g', 'r', 'c', 'm', 'y', 'k'])))
but nothing has changed.
Any ideas? Should I reinstall anything to get out of my issue? and if yes, what?