一、如何画多个子图组合的图,以及修改标题和曲线名字
目前我还没法解决显示中文的问题
最终效果
效果要修改的参数
需要设置的地方核心代码
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)
网友评论