7
votes

I was wondering why seaborn lmplot and regplot only has the option to do logx. I have a frequent use to linearly fit log(y) ~ x and the Y-axis should always be in log scale to show the correlation (as a convention).

Is this something that can be done in Seaborn?

An option of logy=True would be nice...

Thanks.

2

2 Answers

5
votes

You can simply set the y-axis scale to log with:

import seaborn as sns; sns.set(color_codes=True)
tips = sns.load_dataset("tips")
ax = sns.regplot(x="total_bill", y="tip", data=tips)
ax.set_yscale('log')  # set_yscale is a function, not a string
0
votes

You can do it using the axis returned by regplot:

ax = seaborn.regplot('x', 'y', data)
ax.set(yscale='log')