Sunday 8 August 2021

Speed up swarmplot/stripplot in seaborn > 0.9.0?

After an update to seaborn 0.11.1 from 0.9.0 I noticed that swarmplot and stripplot became MUCH slower when adding a hue variable.

I am plotting ~4000 data points across ~100 categories and 3 hue levels.

In seaborn 0.9.0 this was much faster and took ~5 seconds. Now it takes 30-60 seconds.

Without adding a hue variable, the speed is comparable between the versions.

I determined this changed with the update to 0.9.1 by trying various versions of seaborn. Is there a new setting that I missed that I can use to recapitulate the old performance in newer versions of seaborn?

EDIT: Here is an example of what I am trying to do:

dfTest = sns.load_dataset('planets')
sns.stripplot(data=dfTest,
                  x='method',
                  hue='number',
                  y='orbital_period',
                 dodge=True)
    plt.legend().remove()
    plt.ylim([0,1000])
    plt.xticks(rotation=80);

stripplot example

This dataset it not quite as big (1000 rows) as the one I am working with (4000 rows) but it illustrates the point.



from Speed up swarmplot/stripplot in seaborn > 0.9.0?

No comments:

Post a Comment