imshow#

This is a wrapper around matplotlib’s imshow that works better with voxel images

import matplotlib.pyplot as plt

import porespy as ps

ps.visualization.set_mpl_style()

im#

The image to show. Can be 2D or 3D:

im = ps.generators.blobs([100, 100, 100], blobiness=[1, 2, 3])
ps.visualization.imshow(im);
../../../_images/d1742b74b566a2d4e5e4facaa3d318642bde0c2e20ebedf38e9efe50e86d8fd9.png

axis#

3D images must be sliced to present a 2D view. This argument controls which axis to slice along. The default is 2, which is the traditional z-axis, so the function will show an xy slice.

ps.visualization.imshow(im, axis=1);
../../../_images/c4d88b38267c9e4112dfd198725e425748b6b31dc31525927b5116909bb6bcf9.png

ind#

The location or index to slice at, with the default being the midpoint of the specified axis.

ps.visualization.imshow(im, axis=1, ind=10);
../../../_images/fa03c637720d2068f426e018f2df5d2400aa0f42ac4021a99d44bf185460b7e4.png

kwargs#

All other keyword arguments are passed on to plt.imshow. For instance you can set the colormap:

ps.visualization.imshow(im, axis=1, ind=10, cmap=plt.cm.plasma);
../../../_images/15582a58f2fa372c7e47add175386508c8d5408342a5d9374d40dea654c6524a.png