Note
Click here to download the full example code
Background Image¶
Add a background image with add_background_image
import pyvista as pv
from pyvista import examples
Plot an airplane with the map of the earth in the background
earth_alt = examples.download_topo_global()
pl = pv.Plotter()
actor = pl.add_mesh(examples.load_airplane(), smooth_shading=True)
# pl.add_background_image(examples.mapfile)
pl.show()

Out:
[(3140.593704331348, 2919.620300400684, 2375.7925778512454),
(896.9955291748047, 676.0221252441406, 132.19440269470215),
(0.0, 0.0, 1.0)]
Plot several earth related plots
pl = pv.Plotter(shape=(2, 2))
pl.subplot(0, 0)
pl.add_text('Earth Visible as Map')
pl.add_background_image(examples.mapfile, as_global=False)
pl.subplot(0, 1)
pl.add_text('Earth Altitude')
actor = pl.add_mesh(earth_alt, cmap='gist_earth')
pl.subplot(1, 0)
topo = examples.download_topo_land()
actor = pl.add_mesh(topo, cmap='gist_earth')
pl.add_text('Earth Land Altitude')
pl.subplot(1, 1)
pl.add_text('Earth Visible as Globe')
pl.add_mesh(examples.load_globe(), smooth_shading=True)
pl.show()

Out:
[(24578060184.082455, 24590884070.56062, 24590884070.56062),
(-12823886.478166103, 4.76837158203125e-07, 0.0),
(0.0, 0.0, 1.0)]
Total running time of the script: ( 0 minutes 5.505 seconds)