embed_matplotlib1.py 557 B

1234567891011121314151617
  1. """Include background images in the rendering scene
  2. (generated by matplotlib)"""
  3. import matplotlib.pyplot as plt
  4. from vedo import *
  5. tmsh = TetMesh(dataurl + "limb.vtu")
  6. msh = tmsh.tomesh().shrink(0.8)
  7. # Create a histogram with matplotlib
  8. fig = plt.figure()
  9. plt.hist(msh.celldata["chem_0"], log=True)
  10. plt.title(r"$\mathrm{Matplotlib\ Histogram\ of\ log(chem_0)}$")
  11. # pic1 = Image(fig).clone2d("top-right", 0.5).alpha(0.8)
  12. pic2 = Image(dataurl + "images/embryo.jpg").clone2d("bottom-right")
  13. show(msh, fig, pic2, __doc__, bg="lightgrey", zoom=1.2, axes=1)