File: embed_matplotlib1.py

package info (click to toggle)
vedo 2026.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,528 kB
  • sloc: python: 46,376; javascript: 1,900; xml: 437; sh: 110; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Include background images in the rendering scene
(generated by matplotlib)"""
import matplotlib.pyplot as plt
from vedo import *


tmsh = TetMesh(dataurl + "limb.vtu")
msh = tmsh.tomesh().shrink(0.8)

# Create a histogram with matplotlib
fig = plt.figure()
plt.hist(msh.celldata["chem_0"], log=True)
plt.title(r"$\mathrm{Matplotlib\ Histogram\ of\ log(chem_0)}$")

# pic1 = Image(fig).clone2d("top-right", 0.5).alpha(0.8)
pic2 = Image(dataurl + "images/embryo.jpg").clone2d("bottom-right")

show(msh, fig, pic2, __doc__, bg="lightgrey", zoom=1.2, axes=1)