Patches In Seaborn
My intention is to add a patch at a specific coordinate in seaborn's lmplot : Is there anyway to add a rectangular/square patch to lmplot? I was able to get the plot printed out t
Solution 1:
lmplot
as you've learned, returns a FacetGrid
, which stores all of its axes in an axes
property as a 2D numpy array.
So you just need to do something like:
fg = sns.lmplot('A', 'B', hue="group", data=res_me,fit_reg=False,
palette="Set1",size=10, aspect=1,
scatter_kws={"s": 100,"linewidths":2,"edgecolor":"black"})
fg.axes[0, 0].add_patch(patches.Rectangle((0.912, 0.72), 1.02,
0.802,fill=False,edgecolor='green',lw=3))
Note that if your FacetGrid
only has one Axes
object in it, you can access it directly with fg.ax
Post a Comment for "Patches In Seaborn"