"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "", "" "". "" "" "" "" "" "" "" "," "" "" "," "" "" "," "" "," "" ">> Bubble Scatter Chart .py>> Author: Liu Yang>> e-mail: [Email protected]>> blog: www.cnblogs.com/liu66blog "" "" "" "". " "" "" "" "" "" "" "" "" "" "" "" "" "". "" "" "" "" "" "" "" "" "" "" "" #!/usr/bin/env python#-*-Coding: " Utf-8-*-import sys, osimport matplotlib.pyplot as Pltimport numpy as Npimport random# bubble scatter plot bubbledef scatterplot_bubble ( ): n=80 # Random get x<1 number 80 X=np.random.rand (n) # random get y<1 number 80 Y=np.random.rand (n) # define a list of colors color s=[' red ', ' green ', ' gray ', ' purple ', ' yellow ', ' orange ', ' Blue ' # randomly arranges colors random_colors=random.sample (colors,7) # calculates each with The size of the machine scatter Area=np.pi * (Np.random.rand (N) *10) **2 # Plot scatter plot plt.scatter (X,y,c=random_colors,s=area) # Displays the drawing plt. Show () #/If the current module is running as the main module if __name__ = = ' __main__ ': plot=scatterplot_bubble ()
[Python Study Notes] bubble scatter plot