python - Move seaborn plot legend to a different position? -


i'm using factorplot(kind="bar") seaborn.

the plot fine except legend misplaced: right, text goes out of plot's shaded area.

how make seaborn place legend somewhere else, such in top-left instead of middle-right?

building on @user308827's answer: can use legend=false in factorplot , specify legend through matplotlib:

import seaborn sns import matplotlib.pyplot plt sns.set(style="whitegrid")  titanic = sns.load_dataset("titanic")  g = sns.factorplot("class", "survived", "sex",                    data=titanic, kind="bar",                    size=6, palette="muted",                    legend=false) g.despine(left=true) plt.legend(loc='upper left') g.set_ylabels("survival probability") 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -