The python plot ()

With a code that begins with:

A Code: 
Import
matplotlib.pyplot AS PLT Import numpy AS NP Import PANDAS AS PD plt.rcParams [ ' font.sans serif- ' ] = [ ' SimHei ' ] # for normal display Chinese label plt.rcParams [ ' axes.unicode_minus ' ] = False # for normal display negative

Code II:

代码二:
plt.figure() data.plot(kind
='bar') plt.ylabel(u'列标签名字') p=data.cumsum()/data.sum() p.plot(color='r',secondary_y=True,style='-o',linewidth=2) plt.annotate(format(p[6],'.4%'),xy=(6,p[6]),xytext=(6*0.9,p[6]*0.9),arrowprops=dict(arrowstyle="->",connectionstyle="arc3,rad=.2")) plt.ylabel(u'The right Y-axis tag name ' ) plt.show ()

plt.figure () --figure feeling is to the image ID, it can then be indexed to locate

plt.figure (1) - first map plt.figure (2) - second FIG.  

data.plot(kind='bar')

kind = 'bar' - bar linekind = 'line' - line graph kind = 'barh' - Horizontal bar kind = 'hist' - Histogram kind = 'box' - kind boxplot = 'pie' - pie kind = 'scatter' - scattergram  

color = 'r' - red color = 'b' - the blue color = 'g' - Green  

secondary_y = True - Y axis at the right side

style = '- o' - solid circles style = '- o' - dashed circle style = '-' - a solid line style = '-'- - dotted line  

linewidth = 2 - Line Width

plt.annotate()

format(p[6],'.4%')  --

xy = (6, p [6]) - annotated coordinate points

xytext = (6 * 0.9, p [6] * 0.9) - the coordinates of the point text annotations

arrowprops = dict (,) --arrowprops arrow parameter of type of dictionary dict

arrowstyle="->"

connectionstyle-"arc3,rad=.2"  --

Guess you like

Origin www.cnblogs.com/yldu/p/12061208.html