Hi. I am using a code written by @empet here to produce a quiver plot using PlotlyJS. It works very well if the ranges of the two variables are the same (in a system of differential equations). For example, the code below produces an immaculate plot (see the following image).
α = 0.4
n = 0.01
δ = 0.1
ρ = 0.02
σ = 0.5
g = 0.019
z_l = LinRange(0.0, 2.5, 26) # 26-element LinRange{Float64, Int64}
w_l = LinRange(0.0, 2.5, 26) # 26-element LinRange{Float64, Int64}
z = [zi for wi in w_l, zi in z_l] # z mesh grid
w = [wi for wi in w_l, zi in z_l] # w mesh grid
v = (1.0 ./ σ) .* (α .* w .^(α .- 1.0) .- (n .+ δ .+ ρ .+ (g .* σ))) .* z # the first differential equation
u = w .^ α .- z .- (n .+ δ .+ g) .* w # the second differential equation
q4=Quiver(x=w, y=z, u=u, v=v, vector_scale=0.06)
fig4 = quiverPlot(q4; color="#8f180b")
update!(fig4, line_width=0.75, [1],
layout=Layout(width=650, height=650, plot_bgcolor="#faeee0", #vintage background color
template=nothing, xaxis_zeroline=false, yaxis_zeroline=false, xaxis_title=L"k(t)",
yaxis_title = L"c(t)",
)
)
#relayout!(fig4, yaxis_range=[0 ,2.5])
fig4
However, I need to have different ranges for the two variables. In this case, if I change one of the ranges to, e.g., the w_l
range:
z_l = LinRange(0.0, 2.5, 26) # 26-element LinRange{Float64, Int64}
w_l = LinRange(0.0, 12.5, 26) # 26-element LinRange{Float64, Int64}
I get the following plot:
I tried to change the w and z mesh grids and @empet’s original code but had no luck. I also tried to change the xaxis_range
, but it does not work. Apparently, the axes are truncated to the largest domain length.
How can I get rid of the two useless areas in the plot above? I would greatly appreciate any help.
Thanks.