I am trying to find guidance on how to control and customize the legend in Seaborn plots but I can not find any.
To make the issue more concrete I provide a reproduc
I've always found changing labels in seaborn plots once they are created to be a bit tricky. The easiest solution seems to be to change the input data itself, by mapping the values and column names. You can create a new dataframe as follows, then use the same plot commands.
data = surveys_by_year_sex_long.rename(columns={'sex': 'Sex'})
data['Sex'] = data['Sex'].map({'M': 'Male', 'F': 'Female'})
sn.factorplot(
x = "year", y = "wgt", data = data, hue = "Sex",
kind = "bar", legend_out = True,
palette = sn.color_palette(palette = ["SteelBlue" , "Salmon"]),
hue_order = ["Male", "Female"])
Hopefully this does what you need. The potential problem is that if the dataset is large, creating a whole new dataframe in this manner adds some overhead.