I'm moving a Pandas
legend but trying to keep it as patches. It swaps to lines when I try to adjust the parameters - is there a setting I'm missing to stop this happening or am I resetting the legend or something by accident? What am I doing wrong?
The code is a bit complicated so I'm putting in the useful bits. Don't worry about bad formatting, I just skipped out a load of formatting lines to make it simpler to understand.
Simplified code:
my_colors = list(['goldenrod', 'royalblue', 'darkviolet', 'firebrick'])
#set up subplots
fig_heatprop, axes_heatprop = plt.subplots(nrows=2, ncols=1, sharex=True, gridspec_kw = {'height_ratios':[8, 1]})
#make totales percentages
df_touse_perc = df_touse.divide(df_touse.sum(axis=1), axis=0).multiply(100)
ax = df_touse_perc.plot(kind='area', stacked=True, color=my_colors, ax=axes_heatprop[0]) #.legend(bbox_to_anchor=(0.2, -0.3), ncol=2)
but if I try to move the legend, it swaps it from patches to lines
#move legend
ax.legend(loc=9, bbox_to_anchor=(0.2, -0.2), ncol=2)