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.

General usage:

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

For multiple plots in one plotting window, see the documentation.

Available plotting backends and functionality. 'i' means some level of interactive control. '(y)' means avaliability only on rectangular resp. cuboid grids.

| | PyPlot | *Makie | 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 |

Currently, the Makie part probably will have some problems.

Documentation

The basic structure is to create a GridVisualizer p which allows to have a grid of subplots. The visualize! methods then plot into a subplot p[i,j]. Creation of a GridVisiualizer takes a Plotter keyword argument, which allow to specify plotting module. Supported are:

  • From the REPL: GLMakie, PyPlot, VTKView (linux only), Plots (no 3D, no unstructured)
  • From Pluto notebooks: GLMakie PyPlot, Plots, WGLMakie (experimental), MeshCat (experimental)

Note that functionality here mostly will be added on necessity.

API

GridVisualize.SubVisType

A SubVis is just a dictionary which contains plotting information, including type of the plotter and its position in the plot.

GridVisualize.GridVisualizerMethod
GridVisualizer(; Plotter, kwargs...)

Create a plot context.

Plotter: defaults to nothing and can be PyPlot, Plots, VTKView, Makie. This pattern to pass the backend as a module to a plot function allows to circumvent to create heavy default package dependencies.

Depending on the layout keyword argument, a 2D grid of subplots is created. Further ...plot! commands then plot into one of these subplots:

p=GridVisualizer(Plotter=PyPlot, layout=(2,2)
...plot!(p[1,2], ...)
````

A `...plot`  command just implicitely creates a plot context:

julia ...plot(..., Plotter=PyPlot)

is equivalent to

julia p=GridVisualizer(Plotter=PyPlot, layout=(1,1) ...plot!(p,...) ```

Please note that the return values of all plot commands are specific to the Plotter.

Depending on the backend, interactive mode switch between "gallery view" showing all plots at onece and "focused view" showing only one plot is possible.

Keyword arguments:

  • outline: Plot outline of domain. Default: true

  • alpha: Surface alpha value. Default: 0.1

  • colorbar: Show colorbar in plots. Default: true

  • subplot: Actual subplot. Default: (1, 1)

  • zplane: zplane for 3D visualization. Default: 1.7976931348623157e308

  • colormap: Contour plot colormap (any from ColorSchemes.jl). Default: viridis

  • label: Label of plot. Default:

  • cellwise: Cellwise 1D plot, can be slow). Default: false

  • interior: Plot interior of grid. Default: true

  • flevel: isolevel for 3D visualization. Default: 1.7976931348623157e308

  • elev: Elevation angle for 3D visualization (in degrees). Default: 30

  • azim: Azimuth angle for 3D visualization (in degrees). Default: -60

  • colorlevels: Number of color levels for contour plot. Default: 51

  • isolines: Number of isolines in contour plot. Default: 11

  • fast: Fast updates (with Makie, restricted functionality). Default: true

  • fignumber: Figure number (PyPlot). Default: 1

  • title: Plot title. Default:

  • framepos: Subplot position in frame (VTKView). Default: 1

  • zlimits: z limits. Default: (1, -1)

  • flimits: function limits. Default: (1, -1)

  • yplane: yplane for 3D visualization. Default: 1.7976931348623157e308

  • aspect: Aspect ratio modification. Default: 1.0

  • reveal: Show plot immediately (same as :show). Default: false

  • clear: Clear plot before new plot.. Default: true

  • legend: Add legend to plot. Default: true

  • resolution: Plot xy resolution. Default: (500, 500)

  • elevation: Height factor for elevation of 2D plot. Default: 0.0

  • layout: Layout of plots. Default: (1, 1)

  • axisgrid: Show background grid in plots. Default: true

  • color: Color of lines on plot. Default: (0, 0, 0)

  • show: Show plot immediately. Default: false

  • xlimits: x limits. Default: (1, -1)

  • legend_location: Location of legend. Default: upper right

  • edges: Plot grid edges when plotting grid. Default: true

  • xplane: xplane for 3D visualization. Default: 1.7976931348623157e308

  • ylimits: y limits. Default: (1, -1)

Base.sizeMethod
size(p)

Return the layout of a GridVisualizer

GridVisualize.gridplot!Method
gridplot!(p, grid; kwargs...)

Plot grid.

Keyword arguments:

  • outline: Plot outline of domain. Default: true

  • alpha: Surface alpha value. Default: 0.1

  • colorbar: Show colorbar in plots. Default: true

  • subplot: Actual subplot. Default: (1, 1)

  • zplane: zplane for 3D visualization. Default: 1.7976931348623157e308

  • colormap: Contour plot colormap (any from ColorSchemes.jl). Default: viridis

  • label: Label of plot. Default:

  • cellwise: Cellwise 1D plot, can be slow). Default: false

  • interior: Plot interior of grid. Default: true

  • flevel: isolevel for 3D visualization. Default: 1.7976931348623157e308

  • elev: Elevation angle for 3D visualization (in degrees). Default: 30

  • azim: Azimuth angle for 3D visualization (in degrees). Default: -60

  • colorlevels: Number of color levels for contour plot. Default: 51

  • isolines: Number of isolines in contour plot. Default: 11

  • fast: Fast updates (with Makie, restricted functionality). Default: true

  • fignumber: Figure number (PyPlot). Default: 1

  • title: Plot title. Default:

  • framepos: Subplot position in frame (VTKView). Default: 1

  • zlimits: z limits. Default: (1, -1)

  • flimits: function limits. Default: (1, -1)

  • yplane: yplane for 3D visualization. Default: 1.7976931348623157e308

  • aspect: Aspect ratio modification. Default: 1.0

  • reveal: Show plot immediately (same as :show). Default: false

  • clear: Clear plot before new plot.. Default: true

  • legend: Add legend to plot. Default: true

  • resolution: Plot xy resolution. Default: (500, 500)

  • elevation: Height factor for elevation of 2D plot. Default: 0.0

  • layout: Layout of plots. Default: (1, 1)

  • axisgrid: Show background grid in plots. Default: true

  • color: Color of lines on plot. Default: (0, 0, 0)

  • show: Show plot immediately. Default: false

  • xlimits: x limits. Default: (1, -1)

  • legend_location: Location of legend. Default: upper right

  • edges: Plot grid edges when plotting grid. Default: true

  • xplane: xplane for 3D visualization. Default: 1.7976931348623157e308

  • ylimits: y limits. Default: (1, -1)

GridVisualize.gridplot!Method
gridplot!(ctx, grid; kwargs...)

Plot grid.

Keyword arguments:

  • outline: Plot outline of domain. Default: true

  • alpha: Surface alpha value. Default: 0.1

  • colorbar: Show colorbar in plots. Default: true

  • subplot: Actual subplot. Default: (1, 1)

  • zplane: zplane for 3D visualization. Default: 1.7976931348623157e308

  • colormap: Contour plot colormap (any from ColorSchemes.jl). Default: viridis

  • label: Label of plot. Default:

  • cellwise: Cellwise 1D plot, can be slow). Default: false

  • interior: Plot interior of grid. Default: true

  • flevel: isolevel for 3D visualization. Default: 1.7976931348623157e308

  • elev: Elevation angle for 3D visualization (in degrees). Default: 30

  • azim: Azimuth angle for 3D visualization (in degrees). Default: -60

  • colorlevels: Number of color levels for contour plot. Default: 51

  • isolines: Number of isolines in contour plot. Default: 11

  • fast: Fast updates (with Makie, restricted functionality). Default: true

  • fignumber: Figure number (PyPlot). Default: 1

  • title: Plot title. Default:

  • framepos: Subplot position in frame (VTKView). Default: 1

  • zlimits: z limits. Default: (1, -1)

  • flimits: function limits. Default: (1, -1)

  • yplane: yplane for 3D visualization. Default: 1.7976931348623157e308

  • aspect: Aspect ratio modification. Default: 1.0

  • reveal: Show plot immediately (same as :show). Default: false

  • clear: Clear plot before new plot.. Default: true

  • legend: Add legend to plot. Default: true

  • resolution: Plot xy resolution. Default: (500, 500)

  • elevation: Height factor for elevation of 2D plot. Default: 0.0

  • layout: Layout of plots. Default: (1, 1)

  • axisgrid: Show background grid in plots. Default: true

  • color: Color of lines on plot. Default: (0, 0, 0)

  • show: Show plot immediately. Default: false

  • xlimits: x limits. Default: (1, -1)

  • legend_location: Location of legend. Default: upper right

  • edges: Plot grid edges when plotting grid. Default: true

  • xplane: xplane for 3D visualization. Default: 1.7976931348623157e308

  • ylimits: y limits. Default: (1, -1)

GridVisualize.gridplotMethod
gridplot(grid; Plotter, kwargs...)

Plot grid without predefined context.

Keyword arguments:

  • outline: Plot outline of domain. Default: true

  • alpha: Surface alpha value. Default: 0.1

  • colorbar: Show colorbar in plots. Default: true

  • subplot: Actual subplot. Default: (1, 1)

  • zplane: zplane for 3D visualization. Default: 1.7976931348623157e308

  • colormap: Contour plot colormap (any from ColorSchemes.jl). Default: viridis

  • label: Label of plot. Default:

  • cellwise: Cellwise 1D plot, can be slow). Default: false

  • interior: Plot interior of grid. Default: true

  • flevel: isolevel for 3D visualization. Default: 1.7976931348623157e308

  • elev: Elevation angle for 3D visualization (in degrees). Default: 30

  • azim: Azimuth angle for 3D visualization (in degrees). Default: -60

  • colorlevels: Number of color levels for contour plot. Default: 51

  • isolines: Number of isolines in contour plot. Default: 11

  • fast: Fast updates (with Makie, restricted functionality). Default: true

  • fignumber: Figure number (PyPlot). Default: 1

  • title: Plot title. Default:

  • framepos: Subplot position in frame (VTKView). Default: 1

  • zlimits: z limits. Default: (1, -1)

  • flimits: function limits. Default: (1, -1)

  • yplane: yplane for 3D visualization. Default: 1.7976931348623157e308

  • aspect: Aspect ratio modification. Default: 1.0

  • reveal: Show plot immediately (same as :show). Default: false

  • clear: Clear plot before new plot.. Default: true

  • legend: Add legend to plot. Default: true

  • resolution: Plot xy resolution. Default: (500, 500)

  • elevation: Height factor for elevation of 2D plot. Default: 0.0

  • layout: Layout of plots. Default: (1, 1)

  • axisgrid: Show background grid in plots. Default: true

  • color: Color of lines on plot. Default: (0, 0, 0)

  • show: Show plot immediately. Default: false

  • xlimits: x limits. Default: (1, -1)

  • legend_location: Location of legend. Default: upper right

  • edges: Plot grid edges when plotting grid. Default: true

  • xplane: xplane for 3D visualization. Default: 1.7976931348623157e308

  • ylimits: y limits. Default: (1, -1)

GridVisualize.plottertypeMethod
plottertype(Plotter)

Heuristically detect type of plotter, returns the corresponding abstract type fro plotting.

GridVisualize.revealMethod
reveal(p)

Finish and show plot. Same as setting :reveal=true or :show=true in last scalarplot statment for a context.

GridVisualize.scalarplot!Method
scalarplot!(ctx, grid, func; kwargs...)

Plot scalar function on grid as P1 FEM function.

Keyword arguments

  • outline: Plot outline of domain. Default: true

  • alpha: Surface alpha value. Default: 0.1

  • colorbar: Show colorbar in plots. Default: true

  • subplot: Actual subplot. Default: (1, 1)

  • zplane: zplane for 3D visualization. Default: 1.7976931348623157e308

  • colormap: Contour plot colormap (any from ColorSchemes.jl). Default: viridis

  • label: Label of plot. Default:

  • cellwise: Cellwise 1D plot, can be slow). Default: false

  • interior: Plot interior of grid. Default: true

  • flevel: isolevel for 3D visualization. Default: 1.7976931348623157e308

  • elev: Elevation angle for 3D visualization (in degrees). Default: 30

  • azim: Azimuth angle for 3D visualization (in degrees). Default: -60

  • colorlevels: Number of color levels for contour plot. Default: 51

  • isolines: Number of isolines in contour plot. Default: 11

  • fast: Fast updates (with Makie, restricted functionality). Default: true

  • fignumber: Figure number (PyPlot). Default: 1

  • title: Plot title. Default:

  • framepos: Subplot position in frame (VTKView). Default: 1

  • zlimits: z limits. Default: (1, -1)

  • flimits: function limits. Default: (1, -1)

  • yplane: yplane for 3D visualization. Default: 1.7976931348623157e308

  • aspect: Aspect ratio modification. Default: 1.0

  • reveal: Show plot immediately (same as :show). Default: false

  • clear: Clear plot before new plot.. Default: true

  • legend: Add legend to plot. Default: true

  • resolution: Plot xy resolution. Default: (500, 500)

  • elevation: Height factor for elevation of 2D plot. Default: 0.0

  • layout: Layout of plots. Default: (1, 1)

  • axisgrid: Show background grid in plots. Default: true

  • color: Color of lines on plot. Default: (0, 0, 0)

  • show: Show plot immediately. Default: false

  • xlimits: x limits. Default: (1, -1)

  • legend_location: Location of legend. Default: upper right

  • edges: Plot grid edges when plotting grid. Default: true

  • xplane: xplane for 3D visualization. Default: 1.7976931348623157e308

  • ylimits: y limits. Default: (1, -1)

GridVisualize.scalarplotMethod
scalarplot(grid, func; Plotter, kwargs...)

Plot vector on grid without predefined context as P1 FEM function.

Keyword arguments:

  • outline: Plot outline of domain. Default: true

  • alpha: Surface alpha value. Default: 0.1

  • colorbar: Show colorbar in plots. Default: true

  • subplot: Actual subplot. Default: (1, 1)

  • zplane: zplane for 3D visualization. Default: 1.7976931348623157e308

  • colormap: Contour plot colormap (any from ColorSchemes.jl). Default: viridis

  • label: Label of plot. Default:

  • cellwise: Cellwise 1D plot, can be slow). Default: false

  • interior: Plot interior of grid. Default: true

  • flevel: isolevel for 3D visualization. Default: 1.7976931348623157e308

  • elev: Elevation angle for 3D visualization (in degrees). Default: 30

  • azim: Azimuth angle for 3D visualization (in degrees). Default: -60

  • colorlevels: Number of color levels for contour plot. Default: 51

  • isolines: Number of isolines in contour plot. Default: 11

  • fast: Fast updates (with Makie, restricted functionality). Default: true

  • fignumber: Figure number (PyPlot). Default: 1

  • title: Plot title. Default:

  • framepos: Subplot position in frame (VTKView). Default: 1

  • zlimits: z limits. Default: (1, -1)

  • flimits: function limits. Default: (1, -1)

  • yplane: yplane for 3D visualization. Default: 1.7976931348623157e308

  • aspect: Aspect ratio modification. Default: 1.0

  • reveal: Show plot immediately (same as :show). Default: false

  • clear: Clear plot before new plot.. Default: true

  • legend: Add legend to plot. Default: true

  • resolution: Plot xy resolution. Default: (500, 500)

  • elevation: Height factor for elevation of 2D plot. Default: 0.0

  • layout: Layout of plots. Default: (1, 1)

  • axisgrid: Show background grid in plots. Default: true

  • color: Color of lines on plot. Default: (0, 0, 0)

  • show: Show plot immediately. Default: false

  • xlimits: x limits. Default: (1, -1)

  • legend_location: Location of legend. Default: upper right

  • edges: Plot grid edges when plotting grid. Default: true

  • xplane: xplane for 3D visualization. Default: 1.7976931348623157e308

  • ylimits: y limits. Default: (1, -1)