File: background_image.py

package info (click to toggle)
vedo 2025.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,404 kB
  • sloc: python: 64,792; javascript: 1,932; xml: 437; sh: 139; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 826 bytes parent folder | download
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
"""
Set a jpeg background image
on a separate rendering layer
"""
from vedo import *

# Create a plotter object with 4 subrenderers 
# and individual camera for each one
plt = Plotter(
    N=4,
    sharecam=False, # each subrenderer has its own camera
    bg=dataurl+"images/tropical.jpg", # set the background image
)

# Load a 3D model of a flamingo and rotate it so it is upright
a1 = Cube().rotate_z(20)

# Display a docstring on the second subrenderer
plt.at(2).show(__doc__)

# Zoom in on the background image to fill the window
plt.background_renderer.GetActiveCamera().Zoom(1.8)

# Display a logo on the first subrenderer
plt.at(0).show(VedoLogo(distance=2))

# Display the flamingo model on the fourth subrenderer
plt.at(3).show(a1)

# Allow the plot to be interacted with and then close it
plt.interactive().close()