Skip to content

Commit

Permalink
README update
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Oct 18, 2021
1 parent 3f08177 commit 83305a0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 24 deletions.
77 changes: 55 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,47 @@ GridVisualize
Plotting companion module for [ExtendableGrids.jl](https://github.com/j-fu/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.
are PyPlot, GLMakie and PlutoVista.

## Disclaimer
The code is rather new and quite a few codepaths are untested. Please be prepared to help
fixing things.


## Sample usage:

### Plotting a grid or a function:
### Plotting a grid, a function or a vector field
````
gridplot(grid, Plotter=PyPlot)
scalarplot(grid, function,Plotter=PyPlot)
vectorplot(grid, vectorfunction,Plotter=PyPlot)
streamplot(grid, vectorfunction,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.
variables, respectively. Vector plots are currenly available for 2D only,
and stream plots only for PyPlot.

Plot appearance can be tweaked by a number of
[keyword arguments](https://j-fu.github.io/GridVisualize.jl/dev/api/#GridVisualize.available_kwargs).

### Multiple plots in one plotting window:
### Plotters
Plotters can be e.g. Plots, GLMakie, PlutoVista - we pass the module exported
by the package. Different plotters can be used at the same time.

### 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)
````
(not supported by PlutoVista)

### Transient plots

### Transient plots (using fast updating via observables for Makie)
This using fast updating via observables for GLMakie and persistent divs with PlutoVista.
````
vis=GridVisualizer(Plotter=GLMakie)
for i=1:N
Expand Down Expand Up @@ -59,25 +77,33 @@ gridplot!(vis[1,1],grid)
scalarplot!(vis[1,2],grid,function)
```

When the package is loaded, the default plotter is determined by the installed
plotting package (using Requires.jl).


### 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.
and all plotting functions will do nothing.

## Available plotting backends and functionality.

- 'i' means some level of interactive control
- '(y)' means avaiability only on rectangular resp. cuboid grids.
- 'y': available
- 'i': some level of interactive control
- '(y)': availability only on rectangular grids
- 'p': planned

| | PyPlot | GLMakie | PlutoVista | Plots | VTKView |
|------------|--------|---------|------------|-------|---------|
| scalar, 1D | y | y | y,i | y | y |
| grid, 1D | y | y | y | y | n |
| scalar, 2D | y | y | y | (y) | y,i |
| vector, 2D | y | y | y | y | n |
| stream, 2D | y | n | n | n | n |
| grid, 2D | y | y,i | y | (y) | y,i |
| scalar, 3D | y | y,i | y,i | no | y,i |
| grid, 3D | y | y,i | y,i | no | y,i |
| | PyPlot | GLMakie | PlutoVista | Plots | VTKView |
|----------------|--------|---------|------------|-------|---------|
| scalarplot, 1D | y | y | y,i | y | y |
| gridplot, 1D | y | y | y | y | |
| scalarplot, 2D | y | y | y | (y) | y,i |
| vectorplot, 2D | y | y | y | y | |
| streamplot, 2D | y | p | p | | |
| gridplot, 2D | y | y,i | y | (y) | y,i |
| scalarplot, 3D | y | y,i | y,i | | y,i |
| gridplot, 3D | y | y,i | y,i | | y,i |
| vectorplot, 3D | p | p | p | | |
| streamplot, 3D | | p | p | | |



Expand All @@ -102,10 +128,17 @@ and all plotting functions will do nothing. This also is the default.


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

Plotting in Pluto notebooks using [PlutoVista.jl](https://github.com/j-fu/PlutoVista.jl) is under
development - see the example notebook: [pluto](https://raw.githubusercontent.com/j-fu/GridVisualize.jl/main/examples/plutovista.jl),
[html](https://j-fu.github.io/GridVisualize.jl/dev/examples/plutovista.html).
### Pluto
Plotting in Pluto notebooks for PyPlot, Plots, GLMakie is working.

Plotting in Pluto notebooks can use [PlutoVista.jl](https://github.com/j-fu/PlutoVista.jl)
based on [plotly.js](https://plotly.com/javascript/) (1D) and [vtk.js](https://kitware.github.io/vtk-js/index.html) (2/3D).
See the example notebook: [pluto](https://raw.githubusercontent.com/j-fu/GridVisualize.jl/main/examples/plutovista.jl),
[html](https://j-fu.github.io/GridVisualize.jl/dev/plutovista.html).


### Jupyter
Chances are that things work with Jupyter as well. Please ping me if you would like to volunteer with testing and
possibly fixing this.

5 changes: 3 additions & 2 deletions examples/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# ## Plotters
# All plot functions in GridVisualize.jl have a `Plotter` keyword argument
# which defaults to `nothing`. This allows to pass a module as plotting backend
# without creating a dependency. Fully supported are `PyPlot` and `GLMakie`.
# without creating a dependency. Fully supported are `PyPlot`, `GLMakie` and `PlutoVista`.
# `WGLMakie` and `CairoMakie` work in principle but in the moment don't deliver
# all necessary functionality. For `Plots` we miss the possibility to work with triangle meshes (this is under development, though)
#
# Also supported is [`VTKView`](https://github.com/j-fu/VTKView.jl) which is exeprimental and works only on linux
# Also supported is [`VTKView`](https://github.com/j-fu/VTKView.jl) which is exeprimental and works only on linux.
#
#
# ## Grid plots
Expand Down Expand Up @@ -132,6 +132,7 @@ end


# ### 2D stream
# Stream plots are currently only available with PyPlot.
function plotting_stream2d(;Plotter=default_plotter(), kwargs...)
g,f=vec2d()
streamplot(g,f; Plotter=Plotter,spacing=0.05,kwargs...)
Expand Down

2 comments on commit 83305a0

@j-fu
Copy link
Member Author

@j-fu j-fu commented on 83305a0 Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/46994

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.7 -m "<description of version>" 83305a054d8bc2444cd9c25ed436511734e72f6f
git push origin v0.3.7

Please sign in to comment.