Plotter.add_background_image#
- Plotter.add_background_image( ) None[source]#
Add a background image to a plot.
- Parameters:
- image_path
str Path to an image file.
- scale
float, default: 1.0 Scale the image larger or smaller relative to the size of the window. The image height is scaled to the height of the render window, or of the subplot when
as_global=False. Its aspect ratio is preserved, so the image is cropped horizontally where it is too wide to fit.- auto_resizebool, default:
True Resize the background when the render window changes size.
- as_globalbool, default:
True When multiple render windows are present, setting
as_global=Falsewill cause the background to only appear in one window.
- image_path
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> from pyvista import examples
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(pv.Sphere())
>>> pl.add_background_image(examples.mapfile)
>>> pl.show()
Used In#
API Examples
Plotter.remove_background_image(1 use)Plotter.save_graphic(1 use)download_milkyway_sky_background(1 use)download_stars_sky_background(1 use)
Gallery Examples