When you make a strategy, you often draw a time series diagram, and the Pyplot library has a plot_date function that meets this requirement.
Function:
Plot_date (x, y, fmt= ' bo ', Tz=none, Xdate=true,
Ydate=false, **kwargs)
wherein, x and/or y can be a sequence of dates represented as float, since 0001-01-01 UTC.
The specific application is as follows:
First, draw a date sequence diagram
Using pyplot
x = [DateTime (2013,10,4):D ates. Day (5):D atetime (2014,10,4,1);] # Generate Time array
y = rand (Length (x), 1)
p = plot_date (x,y,linestyle= "-", marker= "None", label= "Test plot");
Question: If you want a different x-axis format, how to adjust the settings.
(dec-2013=>2013-12)
Two pictures
Using Pyplot
# date
x = [DateTime (2013,10,4):D ates. Day (5):D atetime (2014,10,4,1);] # Generate Time array
y1 = rand (Length (x), 1)
y2 = y1.+ 0.2
#x =dates.format (x, "Yy-mm-dd");
p = plot_date (x,y1,fmt = "O", linestyle= "-", marker= "None", label= "Test plot");
P2= plot_date (x,y2,fmt = "O", linestyle= "-", marker= "None", label= "Test plot");
Third, draw a time-sharing sequence diagram
x = [DateTime (2013,10,4):D ates. Minute (a):D atetime (2013,10,5);]
Y =rand (Length (x), 1);
P =plot_date (x,y,linestyle= "-", marker= "None", label= "Test plot")