Seaborn: regplot label doesn't seem to work?

Created on 6 Aug 2014  Â·  4Comments  Â·  Source: mwaskom/seaborn

The API reference shows that the regplot function can plot a label. However, I can't seem to get the label to appear, whether the regression line is shown or not. Not sure if I'm doing something wrong or if this is a bug?

sns.regplot(x, y, ax=ax, dropna=True, label='label')

Most helpful comment

That gives the plot a label, but like other matplotlib plotting commands to actually _see_ the label you need to make a legend. e.g.

ax = sns.regplot(x, y, ax=ax, dropna=True, label='label')
ax.legend(loc="best")

All 4 comments

That gives the plot a label, but like other matplotlib plotting commands to actually _see_ the label you need to make a legend. e.g.

ax = sns.regplot(x, y, ax=ax, dropna=True, label='label')
ax.legend(loc="best")

Thanks for clarifying. Works as intended.

On 6 Aug 2014, at 17:26, Michael Waskom [email protected] wrote:

That gives the plot a label, but like other matplotlib plotting commands to actually see the label you need to make a legend. e.g.

ax = sns.regplot(x, y, ax=ax, dropna=True, label='label')
ax.legend(loc="best")
—
Reply to this email directly or view it on GitHub.

Great!

I think that the solution ax.legend(loc="best") must be automatic. I lost lot of time searchin the solution of this problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stonebig picture stonebig  Â·  4Comments

TDaltonC picture TDaltonC  Â·  3Comments

rrbarbosa picture rrbarbosa  Â·  3Comments

phantom0301 picture phantom0301  Â·  3Comments

ConstantinoSchillebeeckx picture ConstantinoSchillebeeckx  Â·  4Comments