Julia:P Yplot's Plot_date_plot

Source: Internet
Author: User
Tags rand

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")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.