1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
Examples
========
.. currentmodule:: pyvista
PyVista contains a variety of built-in demos and downloadable example
datasets.
Built-In
--------
Several built-in datasets are included and are available for offline use.
For example, load the built-in :func:`~pyvista.examples.examples.load_random_hills`
dataset:
.. pyvista-plot::
>>> from pyvista import examples
>>> hills = examples.load_random_hills()
>>> hills.plot()
See the API reference for more examples:
.. autosummary::
:toctree: _autosummary
examples.examples
Downloads
---------
Many datasets are too large to be included with PyVista, but can be
downloaded and cached locally. For example, we can download the
:func:`~pyvista.examples.downloads.download_turbine_blade` dataset:
.. pyvista-plot::
>>> from pyvista import examples
>>> blade_mesh = examples.download_turbine_blade()
>>> blade_mesh.plot()
See the API reference for more downloads:
.. autosummary::
:toctree: _autosummary
examples.downloads
Demos
-----
PyVista also contains some demos which can be used to quickly
demonstrate features. For example, we can create and show the
orientation cube plotter demo:
.. pyvista-plot::
>>> from pyvista import demos
>>> plotter = demos.orientation_plotter()
>>> plotter.show()
See the API reference for more demos:
.. autosummary::
:toctree: _autosummary
demos.demos
Planets
-------
Examples of planets and celestial bodies are also included. See the
API reference for details:
.. autosummary::
:toctree: _autosummary
examples.planets
3D Scene Datasets
-----------------
Some file formats are imported directly by the :class:`pyvista.Plotter`
instead of using :func:`pyvista.read`. These formats represent 3D geometry,
materials, and scene structure.
Examples of file formats supported by PyVista include ``VRML``
(VirtualReality Modeling Language), ``3DS`` (3D Studio), and
``glTF`` (Graphics Library Transmission Format).
See the API reference for details:
.. autosummary::
:toctree: _autosummary
examples.vrml
examples.download_3ds
examples.gltf
Cells
-----
Many examples of VTK :class:`cell types <pyvista.CellType>` are
available. These functions create single-cell :class:`pyvista.UnstructuredGrid`
objects which can be useful for learning about the different cells.
See the API reference for details:
.. autosummary::
:toctree: _autosummary
examples.cells
Dataset Gallery
---------------
Most of PyVista's datasets are showcased in the dataset gallery.
You can browse the gallery to find a particular kind of dataset and
view file and instance metadata for all datasets.
.. toctree::
:maxdepth: 3
/api/examples/dataset_gallery
Usage Considerations
--------------------
.. warning::
As you browse this repository and think about how you might use our 3D
models and range datasets, please remember that several of these artifacts
have religious or cultural significance.
Examples include the Buddha, a religious symbol revered by hundreds of
millions of people; the dragon, a symbol of Chinese culture, the Thai
statue, which contains elements of religious significance to Hindus; and Lucy, a
Christian angel commonly seen as statues in Italian churches.
Keep your renderings and other uses of these particular models in good
taste. Don't animate or morph them, don't apply Boolean operators to them,
and don't simulate nasty things happening to them (like breaking, exploding,
melting, etc.).
Choose another model for these sorts of experiments.
(You can do anything you want to the Stanford bunny or the armadillo.)
Downloads Cache and Data Sources
--------------------------------
If you have an internet connection and a normal user account, PyVista should be
able to download and cache examples without an issue. The following two
sections deal with those who wish to customize how PyVista downloads examples.
Cache
~~~~~
PyVista uses `pooch <https://github.com/fatiando/pooch>`_ to download and store
the example files in a local cache. You can determine the location of this cache
at runtime with:
.. code-block:: python
>>> from pyvista import examples
>>> # Get the local examples path on Linux
>>> examples.PATH
'/home/user/.cache/pyvista_3'
You can clear out the local cache with :func:`examples.delete_downloads()
<pyvista.examples.downloads.delete_downloads>` if needed.
If you want to override this local cache path, set the
``PYVISTA_USERDATA_PATH`` environment variable. This path must be writable.
Data Sources
~~~~~~~~~~~~
PyVista uses `PyVista/vtk-data <https://github.com/pyvista/vtk-data.git>`_ as
the main source for example data. If you do not have internet access or you
prefer using a local or network directory instead, you can override this
source with the ``VTK_DATA_PATH`` environment variable.
The following example first clones the git repository and then exports that
directory to PyVista via ``VTK_DATA_PATH``. Note how the path ends in
``'Data'`` since we need to specify the exact directory of the Data for
``pooch``.
.. code-block:: bash
git clone https://github.com/pyvista/vtk-data.git
export VTK_DATA_PATH=/home/alex/python/vtk-data/Data
|