Data format:
riqi, total1, total2
2019-06-01,62192,627
2019-06-02,546240,546
2019-06-03,6603,6597
2019-06-04,5943,594
2019-06-05,61289,6128
2019-06-06,65090,6500
2019-06-07,52632,526
2019-06-08,44949,47449
2019-06-09,4720,472
2019-06-10,8143,8173
2019-06-11 , 6382,89712
2019-06-12,61356,656
2019-06-13,6038,6638
2019-06-14,73,700
2019-06-15,52,529
2019-06-16,538,536
2019-06-17,6463,64624
2019-06-18,224,654
2019-06-19,5989,5930
2019-06-20,5989,5930
2019-06-21,6234,623
2019-06-22,663,64062
2019-06-22,497,49736
2019-06- 23,4454,445
2019-06-24,5791,573
2019-06-25,5839,539
2019-06-26,186,59
2019-06-27,6209,629
2019-06-28,9654,964
2019-06-29,500,500
2019-06-30,5104,51904
Drawing:
import pandas as pd
import numpy as np
from pandas import Series,DataFrame
import matplotlib.pyplot as plt
from pylab import mpl # plt set may be displayed Chinese
mpl.rcParams [ 'serif-font.sans'] = [ 'FangSong']
mpl.rcParams [ 'axes.unicode_minus'] = False
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
shuju = pd.read_csv("wenjian")
def x (r1, r2):
Return List (Range (r 1, r 2 + 1))
r 1, r 2 = 1.30
x = list (x (r 1, r 2))
y = shuju [ 'Total1']
plt.plot ( x, y, fields = 'O')
ZIP in XY for (X, Y):
plt.annotate ( 'local max', XY = (19,5989), xytext = (20,6000), arrowprops = dict (facecolor = 'Black', Shrink = from 0.001, width = 0.001)) of the specified data set tag #
plt.annotate ( "(% s,% s)"% xy, xy = xy, xytext = (- 20, 10), textcoords = 'offset points') # all data settings tab
plt.show()
Description annotate Syntax: annotate (s = 'str', xy = (x, y), xytext = (l1, l2), ..)
s is a text annotation
xy coordinate point annotated as being
a coordinate position of the comment text xytext
xycoords parameters are as follows:
- figure points points from the lower left of the figure in the lower left point
- figure pixels pixels from the lower left of the figure the bottom left of the pixel of FIG.
- figure fraction fraction of figure from lower left portion of the lower left corner of the digital
- axes points points from lower left corner of axes from the bottom left coordinate point
- axes pixels pixels from lower left corner of axes from the bottom left corner pixel coordinates
- axes fraction fraction of axes from lower left portion of the lower left corner
- data use the coordinate system of the object being annotated coordinate system (default) using the annotated objects (default)
- polar(theta,r) if not native ‘data’ coordinates t
extcoords disposed offset comment text
arrowprops # arrow parameter of type as a dictionary dict
- width the width of the arrow in points the width of the point of the arrow
- Width headwidth the width of the base of the arrow head in points in the base point of the arrow
- headlength the length of the arrow head in points of the point of the arrow length
- shrink fraction of total length to 'shrink' from both ends of the total length score "shrink" from both ends
- facecolor Arrow Color
bbox to increase the frame header, common parameters are as follows:
- block shape boxstyle
- facecolor (abbreviated fc) the background color
- edgecolor (abbreviated ec) border line color
- edgewidth border line size
bbox=dict(boxstyle='round,pad=0.5', fc='yellow', ec='k',lw=1 ,alpha=0.5) #fc为facecolor,ec为edgecolor,lw为lineweight