Home > Net >  How to create multiple legends?
How to create multiple legends?

Time:08-13

fig, ax = plt.subplots(figsize = (10,7))
sns.lineplot(data = dearborn_1111_groupby,
            x = 'Date',
            y = 'Rent',
            hue = 'generic_type',
            palette = 'husl',
            ax = ax).set_title('1111 Dearborn Median In Place Rents (2018 - 2022)')

sns.lineplot(data = dearborn_1111_groupby,
            x = 'Date',
            y = 'Rent_apartlist',
            color = 'black',
            ax = ax)

ax.legend(bbox_to_anchor = (1.15, 0.95), title = 'Unit Type')
plt.show()

two linesplots with legend

  • Related