Mercurial > repos > public > sbplib_julia
comparison ext/DiffinitiveMakieExt.jl @ 1801:2b5f81e288f1 feature/grids/manifolds
Merge feature/grids/curvilinear
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 02 Oct 2024 08:51:37 +0200 |
parents | 4d55ac2892a2 |
children |
comparison
equal
deleted
inserted
replaced
1784:c5070edd0ebb | 1801:2b5f81e288f1 |
---|---|
31 end | 31 end |
32 | 32 |
33 | 33 |
34 ## Grids | 34 ## Grids |
35 | 35 |
36 Makie.convert_arguments(::Type{<:Scatter}, g::Grid) = (reshape(map(Point,g),:),) # (map(Point,collect(g)[:]),) | 36 Makie.convert_arguments(::Type{<:Scatter}, g::Grid) = (reshape(map(Point,g),:),) |
37 function Makie.convert_arguments(::Type{<:Lines}, g::Grid{<:Any,2}) | 37 function Makie.convert_arguments(::Type{<:Lines}, g::Grid{<:AbstractVector}) |
38 M = collect(g) | 38 M = collect(g) |
39 | 39 |
40 function cat_with_NaN(a,b) | 40 function cat_with_NaN(a,b) |
41 vcat(a,[@SVector[NaN,NaN]],b) | 41 vcat(a,[@SVector fill(NaN, coordinate_size(g))],b) |
42 end | 42 end |
43 | 43 |
44 xlines = reduce(cat_with_NaN, eachrow(M)) | 44 xlines = reduce(cat_with_NaN, eachrow(M)) |
45 ylines = reduce(cat_with_NaN, eachcol(M)) | 45 ylines = reduce(cat_with_NaN, eachcol(M)) |
46 | 46 |
47 return (cat_with_NaN(xlines,ylines),) | 47 return (cat_with_NaN(xlines,ylines),) |
48 end | 48 end |
49 | 49 |
50 Makie.plot!(plot::Plot(Grid{<:Any,2})) = lines!(plot, plot.attributes, plot[1]) | 50 Makie.plot!(plot::Plot(Grid)) = lines!(plot, plot.attributes, plot[1]) |
51 | 51 |
52 | 52 |
53 ## Grid functions | 53 ## Grid functions |
54 | 54 |
55 ### 1D | 55 ### 1D |