matplotlib python3 the drawing, plt.bar drawing dendrogram

  python3 in the drawing, matplotlib used, can be installed without installing pip install matplotlib:

Import matplotlib
 Import matplotlib.pyplot AS plt    # data visualization 

matplotlib.rcParams [ " font.sans serif- " ] = [ " simhei " ] # Configure the default font does not support Chinese 
matplotlib.rcParams [ " font.family " ] = " sans- serif " 

# [. 1], [2], [. 3], [. 4], [. 5] represents the order 
# [123], [113], [133], [133], [133] represents the value of 
# label = U "Guangdong" represents the name of 
# color = "G" represents the designated color 
plt.bar ([. 1], [123], U = label " Guangdong " , color = "g")    # Bar tree 
plt.bar ([2], [113], U = label " Jiangsu " , Color = " Y " ) 
plt.bar ([ . 3], [133], U = label " Shandong " ) 
PLT .bar ([ . 4], [133], U = label " Henan " ) 
plt.bar ([ . 5], [133], U = label " Zhejiang " ) 


# matplotlib ( "Agg") 
plt.legend ()    # draw 
plt.savefig ( " 1.png " )   # save the image to your local 
# plt.show () # display

 

Guess you like

Origin www.cnblogs.com/my-global/p/12447252.html