数据可视化之matplotlib实战:plt.scatter()函数 绘制气泡图

    科技2022-07-10  128

    import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np # 防止乱码 mpl.rcParams["font.sans-serif"] = ["SimHei"] mpl.rcParams["axes.unicode_minus"] = False a = np.random.randn(100) b = np.random.randn(100) # colormap:RdYlBu plt.scatter(a,b,s=np.power(10*a+20*b,2), c=np.random.rand(100), cmap=mpl.cm.RdYlBu, marker="o") plt.show()

    Processed: 0.029, SQL: 8