Extract Array to Table

This example will demonstrate how to extract an array from any input data set to make a pyvista.Table of that single data array. Aftwards, we plot a histogram of that data array.

This example demos PVGeo.filters.ExtractArray

from PVGeo.filters import ExtractArray
from pyvista import examples
import matplotlib.pyplot as plt

Create input data

dataset = examples.download_st_helens()

Construct the filter

filt = ExtractArray()
# Define the array to extract
# Apply the filter on the input
table = filt.apply(dataset, 'Elevation')
print(table)

Out:

Table (0x7f6a5d625ee8)
  N Rows:       152709
  N Arrays:     1
plt.hist(table['Elevation'])
extract array

Out:

(array([14075., 31732., 38605., 28616., 13749.,  9270.,  7174.,  4687.,
        3199.,  1602.]), array([ 682. ,  868.1, 1054.2, 1240.3, 1426.4, 1612.5, 1798.6, 1984.7,
       2170.8, 2356.9, 2543. ], dtype=float32), <a list of 10 Patch objects>)

Total running time of the script: ( 0 minutes 0.624 seconds)

Gallery generated by Sphinx-Gallery