How to move the legend in Seaborn FacetGrid outside of the plot?
问题 I have the following code: g = sns.FacetGrid(df, row="Type", hue="Name", size=3, aspect=3) g = g.map(sns.plt.plot, "Volume", "Index") g.add_legend() sns.plt.show() This results in the following plot: How can I move the legend outside of the plot? 回答1: You can do this by resizing the plots: g = sns.FacetGrid(df, row="Type", hue="Name", size=3, aspect=3) g = g.map(sns.plt.plot, "Volume", "Index") for ax in g.axes.flat: box = ax.get_position() ax.set_position([box.x0,box.y0,box.width*0.9,box