plot_vpython

openpnm.topotools.plot_vpython(network, Psize='pore.diameter', Tsize='throat.diameter', Pcolor=None, Tcolor=None, cmap='jet', **kwargs)[source]

Quickly visualize a network in 3D using VPython.

Parameters
  • network (GenericNetwork) – The network to visualize.

  • Psize (str (default = 'pore.diameter')) – The dictionary key pointing to the pore property by which sphere diameters should be scaled

  • Tsize (str (default = 'throat.diameter')) – The dictionary key pointing to the throat property by which cylinder diameters should be scaled

  • Pcolor (str) – The dictionary key pointing to the pore property which will control the sphere colors. The default is None, which results in a bright red for all pores.

  • Tcolor (str) – The dictionary key pointing to the throat property which will control the cylinder colors. The default is None, which results in a unform pale blue for all throats.

  • cmap (str or Matplotlib colormap object (default is 'jet')) – The color map to use when converting pore and throat properties to RGB colors. Can either be a string indicating which color map to fetch from matplotlib.cmap, or an actual cmap object.

  • kwargs (dict) –

    Any additional kwargs that are received are passed to the VPython canvas object. Default options are:

    ’height’ = 500 - Height of canvas

    ’width’ = 800 - Width of canvas

    ’background’ = [0, 0, 0] - Sets the background color of canvas

    ’ambient’ = [0.2, 0.2, 0.3] - Sets the brightness of lighting

Returns

canvas – The canvas object containing the generated scene. The object has several useful methods.

Return type

VPython Canvas object

Notes

Important

a) This does not work in Spyder. It should only be called from a Jupyter Notebook.

b) This is only meant for relatively small networks. For proper visualization use Paraview.