I would like to show multiple smoothed order lines in the same graph using lmplot
from seaborn
. For example I would like to show an smoothed order line of 1 and 5 colored in the same graph. Here are two example graphs I would like to have combined in one:
import seaborn as sns
tips = sns.load_dataset("tips")
sns.lmplot(x="total_bill", y="tip", order = 1, ci = None, truncate = True, data=tips)
Output order = 1
:
sns.lmplot(x="total_bill", y="tip", order = 5, ci = None, truncate = True, data=tips)
Output order = 5
:
So I would like to show these two lines in one graph with a legend. It is not supported to have a list as input for the order
argument. Does anyone know if it is possible to show multiple smoothed order lines in the same graph using lmplot
from seaborn
?
You can give use regplot
(which lmplot
is based on), and initialise an Axes object first, in which case it will just get the current Axes and plot on it. You can probably do this with lmplot
too, just too lazy to figure it out...
_, ax = plt.subplots()
sns.regplot(label='order=1', order=1, x="total_bill", y="tip"...etc)
sns.regplot(label='order=5', order=5, x="total_bill", y="tip"...etc)
plt.legend()