1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-09-19 19:01:17 +00:00
ReCo.jl/graphics/CairoMakie_graphics/elliptical_distance.jl

32 lines
660 B
Julia
Raw Permalink Normal View History

2022-04-05 01:22:39 +00:00
using CairoMakie
using LaTeXStrings: @L_str
2022-04-06 13:37:01 +00:00
include("../../visualization/common_CairoMakie.jl")
2022-04-05 01:22:39 +00:00
function gen_elliptical_distance_graphics()
init_cairomakie!()
fig = gen_figure()
ax = Axis(fig[1, 1]; xlabel=L"x", ylabel=L"y")
elliptical_b_a_ratio = 0.4
2022-05-01 10:35:36 +00:00
as = 1:3
2022-04-05 01:22:39 +00:00
for a in as
x = collect(LinRange(-a, a, 1000))
y = @. sqrt(a^2 - x^2) * elliptical_b_a_ratio
append!(x, reverse(x))
append!(y, reverse(-y))
2022-05-01 10:35:36 +00:00
lines!(ax, x, y; label=L"a = %$a")
2022-04-05 01:22:39 +00:00
end
axislegend(ax; position=:rt, padding=3, rowgap=-3)
set_gaps!(fig)
save_fig("elliptical_distance.pdf", fig)
return nothing
end