-2

I am trying to make a 2D plot with a bivariate density graph with seaborn. Basically, it shows the density of the joint occurrence of two variables in the 2D plane, like the image show below

enter image description here

The x and y data for this plot are stored in a dataframe df with columns 'x' and 'y'.

I am able to get this with seaborn using

sns.jointplot(data=df, x=df['x'], y=df['y'], kind = 'kde', fill = True)

However, I find that this plot gets very slow as the size of df increases. Are there any ways to make this plot faster in seaborn?

E_net4
  • 27,810
  • 13
  • 101
  • 139

1 Answers1

0

Instead of making the plot faster, why not average the data over short intervals which would reduce the dataset by the factor of n (n being the number of datapoints a window will average)

For example: data = [1,2,3,4,5,6,7,8,9,10] Averaging by the window size of 2, the data will look like this:

data = [1.5, 3.5, 5.5, 7.5, 9.5]
E_net4
  • 27,810
  • 13
  • 101
  • 139