コード例 #1
0
ファイル: plot-scalar-bars.py プロジェクト: mmagnuski/vtki
"""

# sphinx_gallery_thumbnail_number = 2
import vtki
from vtki import examples

################################################################################
# By default, when plotting a dataset with a scalar array, a scalar bar for that
# array is added. To turn off this behavior, a user could specify
# ``show_scalar_bar=False`` when calling ``.add_mesh()``. Let's start with a
# sample dataset provide via ``vtki`` to demonstrate the default behavior of
# scalar bar plotting:

# Load St Helens DEM and warp the topography
mesh = examples.download_st_helens().warp_by_scalar()

# First a default plot with jet colormap
p = vtki.Plotter()
# Add the data, use active scalar for coloring, and show the scalar bar
p.add_mesh(mesh)
# Display the scene
p.show()

################################################################################
# We could also plot the scene with an interactive scalar bar to move around and
# place where we like by specifying passing keyword arguments to control the
# scalar bar via the ``scalar_bar_args`` parameter in :func:`vtki.BasePlotter.add_mesh`.
# The keyword arguments to control the scalar bar are defined in
# :func:`vtki.BasePlotter.add_scalar_bar`.
コード例 #2
0
 def test_download_st_helens():
     data = examples.download_st_helens()
     assert data.n_points