I\'m plotting something with seaborn\'s regplot. As far as I understand, it uses pyplot.scatter behind the scenes. So I assumed that if I specify c
As a matter of fact you can simply access the seaborn plot's figure object and use its colorbar() function to add a colorbar manually. I find this approach much better.
This code produces the attached plot:
import seaborn as sns
import matplotlib.pyplot as plt
tips = sns.load_dataset("tips")
sns.scatterplot(tips["total_bill"], tips["tip"],
hue=tips["size"], s=75, palette="BuGn", legend=False)
reg_plot=sns.regplot("total_bill", "tip", data=tips, scatter=False, color=".1")
reg_plot.figure.colorbar(mpl.cm.ScalarMappable([![enter image description here][1]][1]norm=mpl.colors.Normalize(vmin=0, vmax=tips["size"].max(), clip=False), cmap='BuGn'),label='tip size')
