GridVisualize.jl

Author j-fu
Popularity
1 Star
Updated Last
1 Year Ago
Started In
January 2021

Build status

GridVisualize

Plotting companion module for ExtendableGrids.jl Provides grid and scalar piecewise linear function plotting for various plotting backends on simplicial grids in one, two or three space dimensions. The main supported backends are PyPlot and GLMakie.

Sample usage:

Plotting a grid or a function:

gridplot(grid, Plotter=PyPlot)
scalarplot(grid, function,Plotter=PyPlot)

This works for 1/2/3D grids and either a function represented by its values on the nodes of the grid, or a scalar function of 1, 2 or 3 variables, respectively.

Multiple plots in one plotting window:

vis=GridVisualizer(Plotter=GLMakie, layout=(1,2))
gridplot!(vis[1,1],grid)
scalarplot!(vis[1,2],grid,function)
reveal(vis)

Transient plots (using fast updating via observables for Makie)

vis=GridVisualizer(Plotter=GLMakie)
for i=1:N
   function=calculate(i)
   scalarplot!(vis,grid,function)
   reveal(vis)
end

Setting a default plotter

Instead of specifying a Plotter in calls to GridVisualizer, gridplot or scalarplot, a default plotter can be set:

default_plotter!(PyPlot)
gridplot(grid)
scalarplot(grid, function)

or

default_plotter!(GLMakie)
vis=GridVisualizer(layout=(1,2))
gridplot!(vis[1,1],grid)
scalarplot!(vis[1,2],grid,function)

Switching off plotting

Just pass Plotter=nothing in the respective places, or set default_plotter!(nothing) and all plotting functions will do nothing. This also is the default.

Available plotting backends and functionality.

The main supported backends are GLMakie and PyPlot.

  • 'i' means some level of interactive control
  • '(y)' means avaiability only on rectangular resp. cuboid grids.
PyPlot GLMakie Plots VTKView
scalar, 1D y y y y
grid, 1D y y y n
scalar, 2D y y,i (y) y,i
grid, 2D y y,i (y) y,i
scalar, 3D y y,i no y,i
grid, 3D y y,i no y,i

For 2D plots, CairoMakie works as well.

PyPlot:

GLMakie:

Plots/gr:

VTKView:

Notebooks

Plotting within Pluto notebooks for PyPlot, Plots, GLMakie is working.