plot_errbars.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """Superpose plots in different styles"""
  2. from vedo.pyplot import plot
  3. from vedo import np, settings
  4. settings.default_font = 'Theemim'
  5. settings.remember_last_figure_format = True
  6. x = np.linspace(0, 10, num=21)
  7. y = 3 * np.sin(x)
  8. ################# first plot
  9. fig = plot(
  10. x, y,
  11. "*r-", # markers: *,o,p,h,D,d,v,^,s,x,a
  12. title=__doc__,
  13. xtitle="t variable (:mus)",
  14. ytitle="y(x) = :pmK_i :dot:sqrtsin^2 t",
  15. aspect=16/9, # aspect ratio x/y of plot
  16. xlim=(-1, 14), # specify x range
  17. axes=dict(text_scale=1.2),
  18. label="3 :dot sin(x)",
  19. )
  20. ################# plot on top of fig
  21. fig += plot(
  22. x + np.pi, y,
  23. "sb--",
  24. like=fig, # format like fig
  25. splined=True, # continuous spline through points
  26. lw=3, # line width
  27. label="3 :dot sin(x - :pi)",
  28. )
  29. ################## plot again on top of fig
  30. fig += plot(x, y/5, "g", label="3/5 :dot sin(x)")
  31. ################## plot again on top of fig
  32. fig += plot(x, y/5-1, "purple5 -", label="3/5 :dot sin(x) - 1")
  33. ################## Show! ##################
  34. fig.add_legend(pos=[0.95,1])
  35. fig.show(size=(1400,900), zoom='tight').close()