def test_download_masonry_texture(): data = examples.download_masonry_texture() assert isinstance(data, vtk.vtkTexture)
Plot a mesh with an image projected onto it as a texture. """ import pyvista as pv from pyvista import examples import numpy as np from matplotlib.cm import get_cmap ############################################################################### # Texture mapping is easily implemented using PyVista. Many of the geometric # objects come preloaded with texture coordinates, so quickly creating a # surface and displaying an image is simply: # load a sample texture tex = examples.download_masonry_texture() # create a surface to host this texture surf = pv.Cylinder() surf.plot(texture=tex) ############################################################################### # But what if your dataset doesn't have texture coordinates? Then you can # harness the :func:`pyvista.DataSetFilters.texture_map_to_plane` filter to # properly map an image to a dataset's surface. # For example, let's map that same image of bricks to a curvey surface: # create a structured surface x = np.arange(-10, 10, 0.25)