openpnm.topotools.plot_coordinates(network, pores=None, ax=None, size_by=None, color_by=None, cmap='jet', color='r', alpha=1.0, marker='o', markersize=10, **kwargs)[source]

Produce a 3D plot showing specified pore coordinates as markers.

  • network (GenericNetwork) – The network whose topological connections to plot.

  • pores (array_like (optional)) – The list of pores to plot if only a sub-sample is desired. This is useful for inspecting a small region of the network. If no pores are specified then all are shown.

  • ax (Matplotlib axis handle) – If ax is supplied, then the coordinates will be overlaid. This enables the plotting of multiple different sets of pores as well as throat connections from plot_connections.

  • size_by (str or array_like) – An ndarray of pore values (e.g. alg[‘pore.concentration’]). These values are normalized by scaled by markersize.

  • color_by (str or array_like) – An ndarray of pore values (e.g. alg[‘pore.concentration’]).

  • cmap (str or cmap object) – The matplotlib colormap to use if specfying a pore property for color_by

  • color (str) – A matplotlib named color (e.g. ‘r’ for red).

  • alpha (float) – The transparency of the lines, with 1 being solid and 0 being invisible

  • marker ('s') – The marker to use. The default is a circle. Options are explained here

  • markersize (scalar) – Controls size of marker, default is 1.0. This value is used to scale the size_by argument if given.

  • **kwargs – All other keyword arguments are passed on to the scatter function of matplotlib, so check their documentation for additional formatting options.


pc – Matplotlib object containing the markers representing the pores.

Return type



To create a single plot containing both pore coordinates and throats, consider creating an empty figure and then pass the ax object as an argument to plot_connections and plot_coordinates. Otherwise, each call to either of these methods creates a new figure.

See also



>>> import openpnm as op
>>> import matplotlib as mpl
>>> import matplotlib.pyplot as plt
>>> mpl.use('Agg')
>>> pn =[10, 10, 3])
>>> pn.add_boundary_pores()
>>> Ps = pn.pores('internal')                       # find internal pores
>>> fig, ax = plt.subplots()                        # create empty figure
>>> _ = op.topotools.plot_coordinates(network=pn,
...                                   pores=Ps,
...                                   color='b',
...                                   ax=ax)        # plot internal pores
>>> Ps = pn.pores('*boundary')                      # find boundary pores
>>> _ = op.topotools.plot_coordinates(network=pn,
...                                   pores=Ps,
...                                   color='r',
...                                   ax=ax)        # plot boundary pores in red