@@ -15,7 +15,7 @@ using Interpolations: linear_interpolation
1515using IntervalSets
1616
1717import GridVisualize: initialize!, save, reveal, gridplot!, scalarplot!, vectorplot!, streamplot!, customplot!, movie, plot_triangulateio!
18- using GridVisualize: MakieType , GridVisualizer, SubVisualizer
18+ using GridVisualize: UnionMakieType , GridVisualizer, SubVisualizer
1919using GridVisualize: isolevels, cellcolors, num_cellcolors, vectorsample, quiverdata, regionmesh, bfacesegments
2020
2121using ExtendableGrids
@@ -24,7 +24,7 @@ using Observables
2424
2525include (" flippablelayout.jl" )
2626
27- function initialize! (p:: GridVisualizer , :: Type{MakieType} )
27+ function initialize! (p:: GridVisualizer , :: Type{MakieType} ) where {MakieType <: UnionMakieType }
2828 XMakie = p. context[:Plotter ]
2929
3030 # Prepare flippable layout
5757add_scene! (ctx, ax) = ctx[:flayout ][ctx[:subplot ]. .. ] = ax
5858
5959# Revealing the visualizer just returns the figure
60- function reveal (p:: GridVisualizer , :: Type{MakieType} )
60+ function reveal (p:: GridVisualizer , :: Type{MakieType} ) where {MakieType <: UnionMakieType }
6161 XMakie = p. context[:Plotter ]
6262 layout = p. context[:layout ]
6363 # For 1D plots the legend should be rendered only once,
@@ -84,18 +84,18 @@ function reveal(p::GridVisualizer, ::Type{MakieType})
8484 end
8585end
8686
87- function reveal (ctx:: SubVisualizer , TP:: Type{MakieType} )
87+ function reveal (ctx:: SubVisualizer , TP:: Type{MakieType} ) where {MakieType <: UnionMakieType }
8888 FlippableLayout. yieldwait (ctx[:flayout ])
8989 if ctx[:show ] || ctx[:reveal ]
9090 return reveal (ctx[:GridVisualizer ], TP)
9191 end
9292 return nothing
9393end
9494
95- function save (fname, p:: GridVisualizer , :: Type{MakieType} )
95+ function save (fname, p:: GridVisualizer , :: Type{MakieType} ) where {MakieType <: UnionMakieType }
9696 return p. context[:Plotter ]. save (fname, p. context[:figure ])
9797end
98- function save (fname, scene, XMakie, :: Type{MakieType} )
98+ function save (fname, scene, XMakie, :: Type{MakieType} ) where {MakieType <: UnionMakieType }
9999 return isnothing (scene) ? nothing : XMakie. save (fname, scene)
100100end
101101
@@ -107,7 +107,7 @@ function movie(
107107 file = nothing ,
108108 format = " gif" ,
109109 kwargs... ,
110- )
110+ ) where {MakieType <: UnionMakieType }
111111 Plotter = vis. context[:Plotter ]
112112 if ! isnothing (file)
113113 format = lstrip (splitext (file)[2 ], ' .' )
@@ -276,7 +276,7 @@ function scenecorners1d(grid, gridscale)
276276end
277277
278278# 1D version
279- function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grid)
279+ function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grid) where {MakieType <: UnionMakieType }
280280 XMakie = ctx[:Plotter ]
281281 nregions = num_cellregions (grid)
282282 nbregions = num_bfaceregions (grid)
354354# #######################################################################
355355# 1D function
356356
357- function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grids, parentgrid, funcs)
357+ function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{1}} , grids, parentgrid, funcs) where {MakieType <: UnionMakieType }
358358 XMakie = ctx[:Plotter ]
359359
360360 nfuncs = length (funcs)
@@ -616,7 +616,7 @@ function set_plot_data!(ctx, key, data)
616616 return haskey (ctx, key) ? ctx[key][] = data : ctx[key] = Observable (data)
617617end
618618
619- function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid)
619+ function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid) where {MakieType <: UnionMakieType }
620620 XMakie = ctx[:Plotter ]
621621
622622 nregions = num_cellcolors (grid, ctx[:cellcoloring ])
@@ -731,7 +731,7 @@ function makescene2d(ctx, key)
731731end
732732
733733# 2D function
734- function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grids, parentgrid, funcs)
734+ function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grids, parentgrid, funcs) where {MakieType <: UnionMakieType }
735735 XMakie = ctx[:Plotter ]
736736 gridscale = ctx[:gridscale ]
737737
@@ -869,7 +869,7 @@ function scalarplot!(ctx, TP::Type{MakieType}, ::Type{Val{2}}, grids, parentgrid
869869end
870870
871871# 2D vector
872- function vectorplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func)
872+ function vectorplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func) where {MakieType <: UnionMakieType }
873873 XMakie = ctx[:Plotter ]
874874
875875 rc, rv = vectorsample (grid, func; gridscale = ctx[:gridscale ], rasterpoints = ctx[:rasterpoints ], offset = ctx[:offset ])
@@ -914,7 +914,7 @@ function vectorplot!(ctx, TP::Type{MakieType}, ::Type{Val{2}}, grid, func)
914914 return reveal (ctx, TP)
915915end
916916
917- function streamplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func)
917+ function streamplot! (ctx, TP:: Type{MakieType} , :: Type{Val{2}} , grid, func) where {MakieType <: UnionMakieType }
918918 XMakie = ctx[:Plotter ]
919919
920920 rc, rv = vectorsample (
@@ -1080,7 +1080,7 @@ pgup/pgdown: coarse control control value
10801080 h: print this message
10811081"""
10821082
1083- function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grid)
1083+ function gridplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grid) where {MakieType <: UnionMakieType }
10841084 function make_mesh (pts, fcs)
10851085 if pkgversion (GeometryBasics) < v " 0.5"
10861086 return GeometryBasics. Mesh (meta (pts; normals = normals (pts, fcs)), fcs)
@@ -1273,7 +1273,7 @@ function gridplot!(ctx, TP::Type{MakieType}, ::Type{Val{3}}, grid)
12731273end
12741274
12751275# 3d function
1276- function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grids, parentgrid, funcs)
1276+ function scalarplot! (ctx, TP:: Type{MakieType} , :: Type{Val{3}} , grids, parentgrid, funcs) where {MakieType <: UnionMakieType }
12771277 levels, crange, colorbarticks = isolevels (ctx, funcs)
12781278 ctx[:crange ] = crange
12791279 ctx[:colorbarticks ] = colorbarticks
@@ -1514,7 +1514,7 @@ end
15141514# Thanks! lines(x, y, axis = (targetlimits = lims,)) indeed makes the limits update.^
15151515# I found that autolimits!(axis) gave good results, even better than me manually computing limits!
15161516
1517- function customplot! (ctx, TP:: Type{MakieType} , func)
1517+ function customplot! (ctx, TP:: Type{MakieType} , func) where {MakieType <: UnionMakieType }
15181518 XMakie = ctx[:Plotter ]
15191519 if ! haskey (ctx, :scene )
15201520 ctx[:scene ] = XMakie. Axis (
@@ -1539,7 +1539,7 @@ function plot_triangulateio!(
15391539 voronoi = nothing ,
15401540 circumcircles = false ,
15411541 kwargs...
1542- )
1542+ ) where {MakieType <: UnionMakieType }
15431543 XMakie = ctx[:Plotter ]
15441544
15451545 function frgb (Plotter, i, max; pastel = false )
0 commit comments