I am using a seaborn pairplot
to plot a scatter plot of different dimensions of my datapoints. However, I want the markers of the datapoints to have a size that corresponds to one of the dimensions of the datapoints. I have the following code:
markersize = 1000* my_dataframe['dim_size'] / sum(my_dataframe['dim_size'])
sns.set_context("notebook", font_scale=1.5, rc={'figure.figsize': [11, 8]})
sns.set_style("darkgrid", {"axes.facecolor": ".9"})
kws = dict(s=markersize, linewidth=.5, edgecolor="w")
sbax = sns.pairplot(my_dataframe, hue='dim_hue' x_vars=['dim_1', 'dim_2'], y_vars=['dim_3', 'dim_4'], size=5, plot_kws=kws)
axes = sbax.axes
for a in axes.flatten():
a.set_ylim([0,1])
a.set_xlim([0,1])
If I do print(kws)
, I see in the dictionary that the sizes are all different and vary from 40 to 2000. However, the markers on the plot are all the same. Is there any way to achieve what I want?
Btw, this works very well with lmplot
if I set the parameter scatter_kws={"s": markersize}
.
Thanks!