Julia :PyPlot的plot_date_plot

來源:互聯網
上載者:User

做策略時,經常會畫到時間順序圖表,PyPlot庫中有一個plot_date函數,可以滿足這個需求。

函數:

plot_date(x, y, fmt='bo', tz=None, xdate=True,             ydate=False, **kwargs)

其中,x and/or y can be a sequence of dates represented as float days since 0001-01-01 UTC.

具體應用如下:

一、畫一個日期順序圖表

using PyPlotx = [DateTime(2013,10,4):Dates.Day(5):DateTime(2014,10,4,1);] # Generate time arrayy = rand(length(x),1)p = plot_date(x,y,linestyle="-",marker="None",label="Test Plot");

問題:如果要不同的X軸格式,如何調整設定。
(Dec-2013=>2013-12)

二、兩張圖

using PyPlot# datex = [DateTime(2013,10,4):Dates.Day(5):DateTime(2014,10,4,1);] # Generate time arrayy1 = 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");


三、畫一個分時順序圖表

x = [DateTime(2013,10,4):Dates.Minute(20):DateTime(2013,10,5);] y =rand(length(x),1);p =plot_date(x,y,linestyle="-",marker="None",label="Test Plot")

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.