Mercurial > repos > public > sbplib_julia
comparison ext/DiffinitiveMakieExt.jl @ 1835:a6f28a8b8f3f refactor/lazy_tensors/elementwise_ops
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 09 Jan 2025 12:40:49 +0100 |
parents | 4d55ac2892a2 |
children |
comparison
equal
deleted
inserted
replaced
1789:48eaa973159a | 1835:a6f28a8b8f3f |
---|---|
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 |