@@ -12,39 +12,43 @@ function vizgrid!(plot::Viz{<:Tuple{RectilinearGrid}}, M::Type{<:𝔼}, pdim::Va
1212 segmentcolor = plot[:segmentcolor ]
1313 segmentsize = plot[:segmentsize ]
1414
15- # process color spec into colorant
16- colorant = Makie. @lift process ($ color, $ colormap, $ colorrange, $ alpha)
15+ if crs (grid[]) <: Cartesian
16+ # process color spec into colorant
17+ colorant = Makie. @lift process ($ color, $ colormap, $ colorrange, $ alpha)
1718
18- # number of vertices and colors
19- nv = Makie. @lift nvertices ($ grid)
20- nc = Makie. @lift $ colorant isa AbstractVector ? length ($ colorant) : 1
19+ # number of vertices and colors
20+ nv = Makie. @lift nvertices ($ grid)
21+ nc = Makie. @lift $ colorant isa AbstractVector ? length ($ colorant) : 1
2122
22- # grid coordinates
23- xyz = Makie. @lift map (x -> ustrip .(x), Meshes. xyz ($ grid))
24- xs = Makie. @lift $ xyz[1 ]
25- ys = Makie. @lift $ xyz[2 ]
23+ # grid coordinates
24+ xyz = Makie. @lift map (x -> ustrip .(x), Meshes. xyz ($ grid))
25+ xs = Makie. @lift $ xyz[1 ]
26+ ys = Makie. @lift $ xyz[2 ]
2627
27- if nc[] == 1
28- # visualize bounding box with a single
29- # color for maximum performance
30- bbox = Makie. @lift boundingbox ($ grid)
31- viz! (plot, bbox, color= colorant)
32- else
33- if nc[] == nv[]
34- # visualize as a simple mesh so that
35- # colors can be specified at vertices
36- vizmesh! (plot, M, pdim, edim)
28+ if nc[] == 1
29+ # visualize bounding box with a single
30+ # color for maximum performance
31+ bbox = Makie. @lift boundingbox ($ grid)
32+ viz! (plot, bbox, color= colorant)
3733 else
38- # visualize as built-in heatmap
39- sz = Makie. @lift size ($ grid)
40- C = Makie. @lift reshape ($ colorant, $ sz)
41- Makie. heatmap! (plot, xs, ys, C)
34+ if nc[] == nv[]
35+ # visualize as a simple mesh so that
36+ # colors can be specified at vertices
37+ vizmesh! (plot, M, pdim, edim)
38+ else
39+ # visualize as built-in heatmap
40+ sz = Makie. @lift size ($ grid)
41+ C = Makie. @lift reshape ($ colorant, $ sz)
42+ Makie. heatmap! (plot, xs, ys, C)
43+ end
4244 end
43- end
4445
45- if showsegments[]
46- tup = Makie. @lift xysegments ($ xs, $ ys)
47- x, y = Makie. @lift ($ tup[1 ]), Makie. @lift ($ tup[2 ])
48- Makie. lines! (plot, x, y, color= segmentcolor, linewidth= segmentsize)
46+ if showsegments[]
47+ tup = Makie. @lift xysegments ($ xs, $ ys)
48+ x, y = Makie. @lift ($ tup[1 ]), Makie. @lift ($ tup[2 ])
49+ Makie. lines! (plot, x, y, color= segmentcolor, linewidth= segmentsize)
50+ end
51+ else
52+ vizgridfallback! (plot, M, pdim, edim)
4953 end
5054end
0 commit comments