pygimli.viewer

Viewer interface for 2D visualizations.

Overview

Functions

hold([val]) TODO WRITEME.
show([mesh, data]) Mesh and model visualization.
showBoundaryNorm(mesh[, normMap]) Show mesh boundaries normals.
showMesh(mesh[, data, hold, block, …]) 2D Mesh visualization.
wait(**kwargs) TODO WRITEME.

Functions

hold

pygimli.viewer.hold(val=1)[source]

TODO WRITEME.

show

pygimli.viewer.show(mesh=None, data=None, **kwargs)[source]

Mesh and model visualization.

Syntactic sugar to show a mesh with data. Forwards to pygimli.viewer.showMesh or pygimli.viewer.mayaview.showMesh3D to show most of the typical 2D and 3D content. See tutorials and examples for usage hints. An empty show call creates an empty ax window.

Parameters:
mesh : GIMLI::Mesh or list of meshes

2D or 3D GIMLi mesh

**kwargs :
  • fitView : bool [True]
    Scale x and y limits to match the view.
  • ax : axe [None]
    Matplotlib axes object. Create a new if necessary.
  • Will be forwarded to the appropriate show functions.
Returns:
Return the results from the showMesh* functions.

See also

showMesh

showBoundaryNorm

pygimli.viewer.showBoundaryNorm(mesh, normMap=None, **kwargs)[source]

Show mesh boundaries normals.

Show the mesh and draw a black line along the normal direction of all boundaries. If you provide a boundary marker vs. norm direction map, then only these norms are drawn.

Parameters:
mesh : GIMLI::Mesh

2D or 3D GIMLi mesh

normMap : list

list of [boundary marker, [norm]] pairs. e.g. [[1, [0.0,1.0]], … ]

**kwargs :

Will be forwarded to the draw functions and matplotlib methods, respectively.

Returns:
ax : matplotlib.ax

showMesh

pygimli.viewer.showMesh(mesh, data=None, hold=False, block=False, colorBar=None, label=None, coverage=None, ax=None, savefig=None, showMesh=False, showBoundary=None, markers=False, **kwargs)[source]

2D Mesh visualization.

Create an axis object and plot a 2D mesh with given node or cell data. Returns the axis and the color bar. The type of data determines the appropriate draw method.

Parameters:
mesh : GIMLI::Mesh

2D or 3D GIMLi mesh

data : iterable [None]

Optionally data to visualize.

. None (draw mesh only)

forward to pygimli.mplviewer.drawMesh or if no cells are given: forward to pygimli.mplviewer.drawPLC

. [[marker, value], …]

List of Cellvalues per cell marker forward to pygimli.mplviewer.drawModel

. float per cell – model, patch

forward to pygimli.mplviewer.drawModel

. float per node – scalar field

forward to pygimli.mplviewer.drawField

. iterable of type [float, float] – vector field

forward to pygimli.mplviewer.drawStreams

. pg.R3Vector – vector field

forward to pygimli.mplviewer.drawStreams

. pg.stdVectorRVector3 – sensor positions

forward to pygimli.mplviewer.drawSensors

hold : bool [false]

Set interactive plot mode for matplotlib. If this is set to false [default] your script will open a window with the figure and draw your content. If set to true nothing happens until you either force another show with hold=False, you call plt.show() or pg.wait(). If you want show with stopping your script set block = True.

block : bool [false]

Force show drawing your content and block the script until you close the current figure.

colorBar : bool [None], Colorbar

Create and show a colorbar. If colorBar is a valid colorbar then only its values will be updated.

label : str

Set colorbar label. If set colorbar is toggled to True. [None]

coverage : iterable [None]

Weight data by the given coverage array and fadeout the color.

ax : matplotlib.Axes [None]

Instead of creating a new and empty ax, just draw into the given one. Useful to combine multiple plots into one figure.

savefig: string

Filename for a direct save to disc. The matplotlib pdf-output is a little bit big so we try an epstopdf if the .eps suffix is found in savefig

showMesh : bool [False]

Shows the mesh itself aditional.

showBoundary : bool [None]

Shows all boundary with marker != 0. A value None means automatic True for cell data and False for node data.

marker : bool [False]

Show mesh and boundary marker.

**kwargs :
  • xlabel : str [None]
    Add label to the x axis
  • ylabel : str [None]
    Add label to the y axis
  • all remaining
    Will be forwarded to the draw functions and matplotlib methods, respectively.
Returns:
ax : matplotlib.axes
colobar : matplotlib.colorbar

Examples

>>> import pygimli as pg
>>> import pygimli.meshtools as mt
>>> world = mt.createWorld(start=[-10, 0], end=[10, -10],
...                        layers=[-3, -7], worldMarker=False)
>>> mesh = mt.createMesh(world, quality=32, area=0.2, smooth=[1, 10])
>>> _ = pg.viewer.showMesh(mesh, markers=True)

wait

pygimli.viewer.wait(**kwargs)[source]

TODO WRITEME.



2019 - GIMLi Development Team
Created using Bootstrap, Sphinx and pyGIMLi 1.0.11+38.g7483f4dd on Sep 20, 2019.