Skip to content

Commit 1f5d5a0

Browse files
committed
Comply to plot_multiscene interface
1 parent 004e1eb commit 1f5d5a0

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

ext/GridVisualizeUnicodePlotsExt.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Extension module for UnicodePlots.jl
55
"""
66
module GridVisualizeUnicodePlotsExt
77

8-
import GridVisualize: initialize!, gridplot!, scalarplot!, vectorplot!, bregion_cmap, region_cmap, reveal
8+
import GridVisualize: initialize!, gridplot!, scalarplot!, vectorplot!, bregion_cmap, region_cmap, reveal, streamplot!
99
using GridVisualize: UnicodePlotsType, GridVisualizer, SubVisualizer, vectorsample, quiverdata
1010
using UnicodePlots: UnicodePlots
1111
using ExtendableGrids: Coordinates, simplexgrid, ON_CELLS, ON_FACES, ON_EDGES, CellNodes, FaceNodes, BFaceNodes, CellGeometries, CellRegions, BFaceRegions, num_cells, num_nodes, local_celledgenodes, num_bfaceregions, num_cellregions, num_targets, interpolate!
@@ -60,6 +60,8 @@ function region_legend!(canvas, title, x, y, colors, text_color)
6060
return
6161
end
6262

63+
gridplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{3}}, grid) = @warn "3D gridplots are not implemented for the UnicodePlots backend"
64+
6365
function gridplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{2}}, grid)
6466
UnicodePlots = ctx[:Plotter]
6567

@@ -350,9 +352,6 @@ function scalarplot!(
350352
xlim = (coord_min, coord_max)
351353
end
352354

353-
# xscale::Symbol = :identity: x-axis scale (:identity, :ln, :log2, :log10), or scale function e.g. x -> log10(x).
354-
# xscale: x axis scale: one of [:log, :identity, :symlog]. Default: :identity
355-
356355
xscale = ctx[:xscale]
357356
xscale == :log && (xscale = :log10)
358357
xscale == :symlog && (xscale = x -> sign(x) * (log10(1 + abs(x))))
@@ -370,7 +369,6 @@ function scalarplot!(
370369
name = name = isnothing(ctx[:label]) ? "" : ctx[:label]
371370

372371
if isnothing(plt)
373-
@show Symbol(ctx[:color])
374372
plt = UnicodePlots.lineplot(
375373
coord[1, :],
376374
func;
@@ -464,6 +462,8 @@ function scalarplot!(
464462
return reveal(ctx, TP)
465463
end
466464

465+
scalarplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{3}}, grids, parentgrid, funcs) = @warn "3D scalarplot is not implemented for the UnicodePlots backend"
466+
467467
function vectorplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{2}}, grid, func)
468468

469469
layout = ctx[:layout]
@@ -560,4 +560,7 @@ function vectorplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{2}}, grid, func
560560
return reveal(ctx, TP)
561561
end
562562

563+
streamplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{2}}, grid, func) = @warn "2D streamplot is not implemented for the UnicodePlots backend"
564+
565+
563566
end # module

0 commit comments

Comments
 (0)