plot_pip.py 877 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. """Picture in picture plotting"""
  2. from vedo import np, settings, show
  3. from vedo.pyplot import plot
  4. settings.default_font = 'Theemim'
  5. def f(x):
  6. return 3*np.exp(-x)*np.cos(2*x)**2
  7. xa = np.arange(0, 0.5, 0.01)
  8. xb = np.arange(0, 4.0, 0.01)
  9. # Build first figure:
  10. fig1 = plot(
  11. xa, f(xa),
  12. title=__doc__,
  13. xtitle='time in seconds',
  14. ytitle='Intensity [a.u.]',
  15. )
  16. # Build second figure w/ options for axes:
  17. fig2 = plot(
  18. xb, f(xb),
  19. title='3 e^-x cos 2x**2 (wider range)',
  20. xtitle=' ', ytitle=' ', # leave empty
  21. c='red5',
  22. axes=dict(
  23. xyplane_color='#dae3f0',
  24. grid_linewidth=0, # make it solid
  25. xyalpha=1, # make it opaque
  26. text_scale=2, # make text bigger
  27. )
  28. )
  29. # Scale fig to make it smaller
  30. fig2.scale(0.04).shift(0.05, 0.75)
  31. fig1.insert(fig2) ############# insert
  32. show(fig1, zoom='tight').close()