| 1 |
""" |
| 2 |
.. _slice_orthogonal_example: |
| 3 |
|
| 4 |
Orthogonal Slices |
| 5 |
~~~~~~~~~~~~~~~~~ |
| 6 |
|
| 7 |
View three orthogonal slices from a mesh. |
| 8 |
|
| 9 |
Use the :func:`pyvista.DataObjectFilters.slice_orthogonal` filter to create these |
| 10 |
slices simultaneously. |
| 11 |
""" |
| 12 |
|
| 13 |
# sphinx_gallery_thumbnail_number = 2 |
| 14 |
import pyvista as pv |
| 15 |
from pyvista import examples |
| 16 |
|
| 17 |
mesh = examples.download_embryo() |
| 18 |
mesh.bounds |
| 19 |
|
| 20 |
# %% |
| 21 |
# Create three slices. Easily control their locations with the ``x``, ``y``, |
| 22 |
# and ``z`` arguments. |
| 23 |
slices = mesh.slice_orthogonal(x=100, z=75) |
| 24 |
|
| 25 |
# %% |
| 26 |
cpos = pv.CameraPosition( |
| 27 |
position=(540.9115516905358, -617.1912234499737, 180.5084853429126), |
| 28 |
focal_point=(128.31920055083387, 126.4977720785509, 111.77682599082095), |
| 29 |
viewup=(-0.1065160140819035, 0.032750075477590124, 0.9937714884722322), |
| 30 |
) |
| 31 |
dargs = dict(cmap='gist_ncar_r') |
| 32 |
|
| 33 |
pl = pv.Plotter() |
| 34 |
pl.add_mesh(slices, **dargs) |
| 35 |
pl.show_grid() |
| 36 |
pl.show(cpos=cpos) |
| 37 |
|
| 38 |
|
| 39 |
# %% |
| 40 |
|
| 41 |
pl = pv.Plotter(shape=(2, 2)) |
| 42 |
# XYZ - show 3D scene first |
| 43 |
pl.subplot(1, 1) |
| 44 |
pl.add_mesh(slices, **dargs) |
| 45 |
pl.show_grid() |
| 46 |
pl.camera_position = cpos |
| 47 |
# XY |
| 48 |
pl.subplot(0, 0) |
| 49 |
pl.add_mesh(slices, **dargs) |
| 50 |
pl.show_grid() |
| 51 |
pl.camera_position = 'xy' |
| 52 |
pl.enable_parallel_projection() |
| 53 |
# ZY |
| 54 |
pl.subplot(0, 1) |
| 55 |
pl.add_mesh(slices, **dargs) |
| 56 |
pl.show_grid() |
| 57 |
pl.camera_position = 'zy' |
| 58 |
pl.enable_parallel_projection() |
| 59 |
# XZ |
| 60 |
pl.subplot(1, 0) |
| 61 |
pl.add_mesh(slices, **dargs) |
| 62 |
pl.show_grid() |
| 63 |
pl.camera_position = 'xz' |
| 64 |
pl.enable_parallel_projection() |
| 65 |
|
| 66 |
pl.show() |
| 67 |
# %% |
| 68 |
# .. tags:: plot |