简体   繁体   English

Plot 多个 Julia 图形上的垂直/水平线

[英]Plot Vertical/Horizontal Lines on Multiple Julia Graphs

I was trying to make several Julia graphs with different arrangements of horizontal/vertical lines:我试图用不同的水平/垂直线排列制作几个 Julia 图:

using Plots


plot_array = Any[]
v_array = [1, 3]
h_array = [9, 10]

push!(variogram_array, plot([1, 2, 3, 4, 5], [1, 4, 9, 16, 25]))
push!(variogram_array, plot([1, 2, 3, 4, 5], [1, 16, 10, 15, 23]))

for i in 1:length(plot_array)
    display(plot(variogram_array..., size = (1000,1000)))
    plot!([v_array[i]], seriestype="vline",label= "rand",line=(:dot, 7))
    plot!([h_array[i]], seriestype="hline",label= "rand",line=(:dot, 7))
end

This code outputs the main graphs, but doesn't include the horizontal and vertical lines as I need it to.此代码输出主图,但不包括我需要的水平线和垂直线。

Is there any way to remedy this?有没有办法解决这个问题? Should I be using Plotly instead?我应该改用 Plotly 吗?

Changing the plot: function to vline and hline and displaying after the lines are added shows the two plots with lines将 plot: function 更改为 vline 和 hline 并在添加线条后显示显示两个带有线条的图

for i in 1:length(variogram_array)
    plt = plot(variogram_array..., size = (1000,1000))
    vline!([v_array[i]], label= "rand",line=(:dot, 7))
    hline!([h_array[i]], label= "rand",line=(:dot, 7))
    display(plt)
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM