def _ts_kde(ax, x, data, color, **kwargs):
 kde_data = []
 (y_min, y_max) = (data.min(), data.max())
 y_vals = np.linspace(y_min, y_max, 100)
 upsampler = interpolate.interp1d(x, data)
 data_upsample = upsampler(np.linspace(x.min(), x.max(), 100))
 for pt_data in data_upsample.T:
  pt_kde = stats.kde.gaussian_kde(pt_data)
  kde_data.append(pt_kde(y_vals))
 kde_data = np.transpose(kde_data)
 rgb = mpl.colors.ColorConverter().to_rgb(color)
 img = np.zeros((kde_data.shape[0], kde_data.shape[1], 4))
 img[:, :, :3] = rgb
 kde_data /= kde_data.max(axis=0)
 kde_data[(kde_data > 1)] = 1
 img[:, :, 3] = kde_data
 ax.imshow(img, interpolation='spline16', zorder=2, extent=(x.min(), x.max(), y_min, y_max), aspect='auto', origin='lower')

def _ts_kde ( ax , x , data , color , ** kwargs ) : kde_data = [ ] ( y_min , y_max ) = ( data . min ( ) , data . max ( ) ) y_vals = np . linspace ( y_min , y_max , 100 ) upsampler = interpolate . interp1d ( x , data ) data_upsample = upsampler ( np . linspace ( x . min ( ) , x . max ( ) , 100 ) ) for pt_data in data_upsample . T : pt_kde = stats . kde . gaussian_kde ( pt_data ) kde_data . append ( pt_kde ( y_vals ) ) kde_data = np . transpose ( kde_data ) rgb = mpl . colors . ColorConverter ( ) . to_rgb ( color ) img = np . zeros ( ( kde_data . shape [ 0 ] , kde_data . shape [ 1 ] , 4 ) ) img [ : , : , : 3 ] = rgb kde_data /= kde_data . max ( axis = 0 ) kde_data [ ( kde_data > 1 ) ] = 1 img [ : , : , 3 ] = kde_data ax . imshow ( img , interpolation = 'spline16' , zorder = 2 , extent = ( x . min ( ) , x . max ( ) , y_min , y_max ) , aspect = 'auto' , origin = 'lower' )
upsample over time and plot a kde of the bootstrap distribution .