bar#

This method is a wrapper for matplotlib’s bar function with additional default settings to visualize a histogram of data.

import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
import inspect
ps.visualization.set_mpl_style()
inspect.signature(ps.visualization.bar)
<Signature (results, h='pdf', **kwargs)>

results#

This is the object returned by porespy’s functions in porespy.metrics. Examples of those functions are pore_size_distribution, radial_density_distribution, etc.

np.random.seed(10)
im = ps.generators.blobs(shape=[500, 500])
im = ps.filters.porosimetry(im)
results = ps.metrics.pore_size_distribution(im=im, log=False)
ps.visualization.bar(results)
<BarContainer object of 10 artists>
../../../_images/da21ef0e42e7d0ed5d34957c5a9f0be1c11532a27bb52a0c4ddaed78f55924c3.svg

h#

The value to use for bin heights. The default is pdf. Depending on the porespy’s metrics function used for generating the results there may be different options for bin heights such as cdf, etc.

ps.visualization.bar(results, h='cdf')
<BarContainer object of 10 artists>
../../../_images/44dddd68c88d03080f49811ce7ed427efc013dc6e3381bdee55778db5a3b4d0f.svg

**kwargs#

Any keyword argument to specify user-defined changes on the histogram (For example edgecolor for changing the default black edge, alpha for tranparency, etc). Note that the keywords must be acceptable keywords by matplotlib’s bar method.

ps.visualization.bar(results, edgecolor='r', alpha=0.5)
<BarContainer object of 10 artists>
../../../_images/67224131856ff78dc83c73ce7daa46b2afeb7bed6a760ceae02aa69d5b9bc1eb.svg