For a plot of mine I need to use move_legend with seaborn. Can someone explain, why move_legend does not want to work in Jupyter Notebook? It runs in PyCharm (takes long); but again not in Spyder. I used an example from this link, to test move_legend in JupyterNotebook
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
penguins = sns.load_dataset("penguins")
sns.set_context("talk", font_scale=1)
plt.figure(figsize=(8,6))
ax = sns.scatterplot(data=penguins,
x="bill_length_mm",
y="flipper_length_mm",
hue="species")
sns.move_legend(
ax, "lower center",
bbox_to_anchor=(.5, 1),
frameon=False,
)
plt.xlabel("Bill Length")
plt.ylabel("Flipper Length")
plt.savefig("Seaborn_move_legend_to_the_top_of_plot.png",
format='png',dpi=150)
Out: AttributeError: module 'seaborn' has no attribute 'move_legend'
Thanks