I use seaborn to plot a grouped bar plot as in https://seaborn.pydata.org/examples/factorplot_bars.html
Giving me: https://seaborn.pydata.org/_images/factorplot_bars.png
there is a title (sex) on the legend which I would like to remove.
How could I achieve that?
A less hacky way is to use the object oriented interface of matplotlib. By gaining control of the axes, it will make it a lot easier to customize the plot.
Results in
If you want the legend to be shown outside of the plot axis, as is default for
factorplot
, you can useFacetGrid.add_legend
(factorplot
returns aFacetGrid
instance). Other methods allow you to adjust the labels of every axis in theFacetGrid
at onceYou can remove the legend title with:
plt.gca().legend().set_title('')
This may be a hacky solution but it works: if you tell Seaborn to leave it off at the time of plotting and then add it back it doesn't have the legend title:
Example result: