comparison ext/DiffinitivePlotsExt.jl @ 1748:03894fd7b132 feature/grids/manifolds

Merge feature/grids/curvilinear
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 11 Sep 2024 15:41:58 +0200
parents ext/SbplibPlotsExt.jl@2a9ec1e2abad
children 3694f11075c5
comparison
equal deleted inserted replaced
1695:a4c52ae93b11 1748:03894fd7b132
1 module DiffinitivePlotsExt
2
3 using Diffinitive.Grids
4 using Plots
5
6 @recipe f(::Type{<:Grid}, g::Grid) = map(Tuple,g)[:]
7
8 @recipe function f(c::Chart{2,<:Rectangle}, n=5, m=n; draw_border=true, bordercolor=1)
9 Ξ = parameterspace(c)
10 ξs = range(limits(Ξ,1)..., n)
11 ηs = range(limits(Ξ,2)..., m)
12
13 label := false
14 seriescolor --> 2
15 for ξ ∈ ξs
16 @series adapted_curve_grid(η->c((ξ,η)),limits(Ξ,1))
17 end
18
19 for η ∈ ηs
20 @series adapted_curve_grid(ξ->c((ξ,η)),limits(Ξ,2))
21 end
22
23 if ~draw_border
24 return
25 end
26
27 for ξ ∈ limits(Ξ,1)
28 @series begin
29 linewidth --> 3
30 seriescolor := bordercolor
31 adapted_curve_grid(η->c((ξ,η)),limits(Ξ,1))
32 end
33 end
34
35 for η ∈ limits(Ξ,2)
36 @series begin
37 linewidth --> 3
38 seriescolor := bordercolor
39 adapted_curve_grid(ξ->c((ξ,η)),limits(Ξ,2))
40 end
41 end
42 end
43
44 function adapted_curve_grid(g, minmax)
45 t1, _ = PlotUtils.adapted_grid(t->g(t)[1], minmax)
46 t2, _ = PlotUtils.adapted_grid(t->g(t)[2], minmax)
47
48 ts = sort(vcat(t1,t2))
49
50 x = map(ts) do t
51 g(t)[1]
52 end
53 y = map(ts) do t
54 g(t)[2]
55 end
56
57 return x, y
58 end
59
60 # get_axis_limits(plt, :x)
61
62
63 # ReicpesPipline/src/user_recipe.jl
64 # @recipe function f(f::FuncOrFuncs{F}) where {F<:Function}
65
66 # @recipe function f(f::Function, xmin::Number, xmax::Number)
67
68 # _scaled_adapted_grid(f, xscale, yscale, xmin, xmax)
69
70 end
71
72