美文网首页
julia plots gr画图系列

julia plots gr画图系列

作者: 昵称违法 | 来源:发表于2020-08-12 16:15 被阅读0次

    一、如何画多个子图组合的图,以及修改标题和曲线名字

    目前我还没法解决显示中文的问题

    最终效果

    效果

    要修改的参数

    需要设置的地方

    核心代码

    p1 = plot(x,y,title = "price",label = "price",legend=:topleft)       #图1的内容
    p1 = plot!(x,z,label = "commax_price")                                  #图1继续添加内容
    p2 = plot(x,hc_ary * (-1),title = "drawdown",label = "hc",legend=:topleft)   #图2的内容
    plot(p1,p2,layout = @layout grid(2,1))  #多图组合
    

    全部代码

    function draw2(df)
        df = @linq df |> where(Date("2017-01-15") .< :日期 .< Date("2020-06-01"))   
        
        a = df.组合
        cummax_a = cummax(a)                  #累计最高值 
        hc_ary = @.(100 * (a / cummax_a -1))  
        max_hc = minimum(hc_ary)
    
        x = df.日期    
        p1 = plot(x,a,title = "price",label = "price",legend=:topleft)  
        p1 = plot!(x,cummax_a,label = "commax_price")
        p2 = plot(x,hc_ary * (-1),title = "drawdown",label = "hc",legend=:topleft)
       
        plot(p1,p2,layout = @layout grid(2,1))
    end
    draw2(res_df)
    

    相关文章

      网友评论

          本文标题:julia plots gr画图系列

          本文链接:https://www.haomeiwen.com/subject/rocmdktx.html