i plot a multiple plot using seabor lmplot and i want to add a x=y line to this plot, can you help me to solve this problem?
my code :
sns.set_theme(style="white")
sns.lmplot(data=data, x='Target',y='Predicted', hue="Type",col='Model', height=5,legend=False, palette=dict(Train="g", Test="m"))
plt.plot([data.iloc[:,0].min(), data.iloc[:,0].max()], [data.iloc[:,0].min(), data.iloc[:,0].max()], "--", label="Perfect model")
plt.legend(loc='upper left')
plt.show()
i plot a multiple plot using seabor lmplot and i want to add a x=y line to this plot, can you help me to solve this problem?
my code :
sns.set_theme(style="white")
sns.lmplot(data=data, x='Target',y='Predicted', hue="Type",col='Model', height=5,legend=False, palette=dict(Train="g", Test="m"))
plt.plot([data.iloc[:,0].min(), data.iloc[:,0].max()], [data.iloc[:,0].min(), data.iloc[:,0].max()], "--", label="Perfect model")
plt.legend(loc='upper left')
plt.show()
The
plt.plot()
that you are using will only add line to the last plot. Do add the line to each line, you will need to use the axes for thelmplot()
and plot a line for each of the subplots. As I don't have your data, used the standard penguins dataset to show this. Hope this helps...