I tried answers from a previous question to no avail in Matplotlib 1.5.1.
I have a seaborn figure:
import seaborn as sns
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
tips = sns.load_dataset("tips")
g = sns.jointplot("total_bill", "tip", data = tips[["total_bill", "tip"]].applymap(lambda x : -np.log10(x)))
This does not work:
g.ax_joint.legend(loc = 'lower right')
As well as this:
plt.legend(bbox_to_anchor=(1.05, 1), loc=4, borderaxespad=0.)
/usr/local/lib/python3.4/dist-packages/matplotlib/axes/_axes.py:520: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labelled objects found. "
What is the way to locate an existing legend to lower right in this case?
Not an elegant solution for now is:
ll = g.ax_joint.get_legend().get_texts()[0]._text
g.ax_joint.get_legend().remove()
g.ax_joint.text( -12, -12, ll, fontsize=14)
However, I believe there should be a better way.