I am Working on a large data set and trying to get some important information from the stacked bar chart but when I plotted it I noticed that colors of the label aren't unique and that is a big issue for me. My goal is to set a unique color for each label I did a lot of research before posting this question here for example. But they aren't working, it's giving error 'AxesSubplot' object has no attribute 'set_color_cycle'
# my dataset is big so I am providing its instance
#suppose I have data of few cites and their complaints
city = ['NEW YORK', 'ASTORIA', 'BRONX', 'BRONX', 'ELMHURST', 'BROOKLYN',
'NEW YORK', 'BRONX', 'KEW GARDENS', 'BROOKLYN']
complaints = ['Noise - Street/Sidewalk', 'Blocked Driveway', 'Blocked Driveway',
'Illegal Parking', 'Illegal Parking', 'Illegal Parking',
'Illegal Parking', 'Blocked Driveway', 'Illegal Parking',
'Blocked Driveway']
# and from this I have created a stack bar chart
test2 = new_cutmr_df[['Complaint Type', 'City']]
cmpltnt_rela = test2.groupby(['City', 'Complaint Type']).size().unstack().fillna(0).plot(kind='bar', legend = True, stacked=True)
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5),ncol=2)
cmpltnt_rela.plot(figsize=(18,14))
whose graph looks something like this
where you can notice color repetition in legend