Seabornプロットで凡例を制御およびカスタマイズする方法に関するガイダンスを探していますが、見つけられません。私は女性として男性とFとMを定義できるようにしたいと思います。この例ではSeaborn-Pythonで凡例を制御する方法
surveys_by_year_sex_long
year sex wgt
0 2001 F 36.221914
1 2001 M 36.481844
2 2002 F 34.016799
3 2002 M 37.589905
%matplotlib inline
from matplotlib import *
from matplotlib import pyplot as plt
import seaborn as sn
sn.factorplot(x = "year", y = "wgt", data = surveys_by_year_sex_long, hue = "sex", kind = "bar", legend_out = True,
palette = sn.color_palette(palette = ["SteelBlue" , "Salmon"]), hue_order = ["M", "F"])
plt.xlabel('Year')
plt.ylabel('Weight')
plt.title('Average Weight by Year and Sex')
、代わりにセックス:
は私が再現可能な例を提供し、問題がより具体化するために、伝説のタイトルとしてセックスをする。あなたのアドバイスは高く評価されます。