Utilities

A few miff-muffet-moof functions.


zip_axes

vtkplotlib.zip_axes(*axes)[source]

Convert vertex data from separate arrays for x, y, z to a single combined points array like most vpl functions require.

Parameters

axes (numpy.ndarray) – Each separate axis to combine.

All axes must have the matching or broadcastable shapes. The number of axes doesn’t have to be 3.

import vtkplotlib as vpl
import numpy as np

vpl.zip_axes(np.arange(10),
             4,
             np.arange(-5, 5))

# Out: array([[ 0,  4, -5],
#             [ 1,  4, -4],
#             [ 2,  4, -3],
#             [ 3,  4, -2],
#             [ 4,  4, -1],
#             [ 5,  4,  0],
#             [ 6,  4,  1],
#             [ 7,  4,  2],
#             [ 8,  4,  3],
#             [ 9,  4,  4]])

See also

unzip_axes() for the reverse.


unzip_axes

vtkplotlib.unzip_axes(points)[source]

Separate each component from an array of points.

Parameters

points (numpy.ndarray) – Some points.

Returns

Each axis separately as a tuple.

Return type

tuple

See zip_axes() more information and the reverse.


quick_test_plot

vtkplotlib.quick_test_plot(fig='gcf')[source]

A quick laziness function to create 30 random spheres.

Parameters

fig (figure or QtFigure) – The figure to plot into, use None for no figure, defaults to the output of vtkplotlib.gcf().

import vtkplotlib as vpl

vpl.quick_test_plot()
vpl.show()