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

import matplotlib.pyplot as plt
from pyvista import examples

from PVGeo.filters import ExtractArray

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')
table
HeaderData Arrays
TableInformation
N Rows152709
N Arrays1
NameTypeN CompMinMax
Elevationfloat3216.820e+022.543e+03


plt.hist(table['Elevation'])
extract array

Out:

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

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

Gallery generated by Sphinx-Gallery