Generate a heatmap in MatPlotLib using a scatter data set

后端 未结 12 2123
南方客
南方客 2020-11-22 09:22

I have a set of X,Y data points (about 10k) that are easy to plot as a scatter plot but that I would like to represent as a heatmap.

I looked through the examples in

12条回答
  •  名媛妹妹
    2020-11-22 10:05

    Seaborn now has the jointplot function which should work nicely here:

    import numpy as np
    import seaborn as sns
    import matplotlib.pyplot as plt
    
    # Generate some test data
    x = np.random.randn(8873)
    y = np.random.randn(8873)
    
    sns.jointplot(x=x, y=y, kind='hex')
    plt.show()
    

提交回复
热议问题