test_pyplot.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. from vedo import shapes, show, dataurl, settings
  4. from vedo import Image, Mesh, Points, Point
  5. from vedo.pyplot import Figure, pie_chart
  6. settings.use_parallel_projection = True
  7. fig = Figure([-1,12], [-2,14], aspect=16/9, padding=0,
  8. title="Lorem Ipsum Neque porro quisquam",
  9. xtitle="test x-axis should always align",
  10. ytitle="y-axis (zeros should match)",
  11. grid=True,
  12. )
  13. print(f"yscale = {fig.yscale}")
  14. man = Mesh(dataurl+'man.vtk').scale(1.4).pos(7,4).rotate_x(-90, around=[7,4,0])
  15. fig += man
  16. pic = Image("https://vedo.embl.es/examples/data/textures/bricks.jpg")
  17. fig += pic.scale(0.005).pos(2,10)
  18. fig += Points([[8,1],[10,3]], r=15)
  19. fig += pie_chart([0.1, 0.2, 0.3, 0.1, 0.3], c=[1,2,3,4,'w']).scale(1).pos(1,6,.2)
  20. fig += Point([2,3])
  21. fig += Point([4,5])
  22. fig += shapes.Circle([4,5])
  23. fig += shapes.Circle([0,0], r=3)
  24. fig += shapes.Circle([0,12], r=3).c("r6")
  25. fig += shapes.Circle([11,12], r=3).c("p5")
  26. fig += shapes.Circle([11,0], r=3).c("o5")
  27. fig += shapes.Arrow([2,3], [4,5]).z(.05)
  28. fig += shapes.Line( [2,3], [4,5]).z(.1).lw(2)
  29. fig += shapes.Line([2,2], [4,4], c='k', lw=6).z(.1)
  30. fig += shapes.DashedLine([8,3],[10,5], spacing=0.5, c='r')
  31. fig += shapes.Tube([[8,2,0],[10,4,0]], r=.1).lighting('ambient')
  32. fig+= shapes.Marker('.').pos(5,5).scale(12)
  33. fig+= shapes.Star3D().pos(5,7).scale(0.5)
  34. fig+= shapes.Cross3D().pos(5,3).scale(0.5)
  35. fig += shapes.Glyph([[5,9]], shapes.Sphere(r=0.5))
  36. fig += shapes.Spline([[4,0],[5,2],[6,0],[7,0.5]]).c('r4')
  37. fig += shapes.CSpline([[4,0],[5,2],[6,0],[7,0.5]]).c('r6')
  38. fig += shapes.KSpline([[4,0],[5,2],[6,0],[7,0.5]]).c('r8')
  39. fig += shapes.Bezier([[4,-1],[5,1],[6,-1],[7,-1.5]])
  40. fig += shapes.Brace([2,1], [4,3],comment='Brace', padding1=0, italic=3).z(0.1) ## BUGGED
  41. fig+= shapes.Ribbon(shapes.Spline([[4,0],[5,2],[6,0],[7,0.5]]),
  42. shapes.Bezier([[4,-1],[5,1],[6,-1],[7,-1.5]]))
  43. fig+= shapes.Star([8,6])
  44. fig+= shapes.Sphere([8,9,0])
  45. fig+= shapes.Spheres([[8,10,0],[9,10,0]], r=0.2, c='g')
  46. fig += shapes.Ellipsoid().pos(9,11)
  47. fig += shapes.Grid().scale(2).pos(7,11)
  48. fig += shapes.Rectangle([2,6], [4,8], radius=0.1).c('b5')
  49. fig += shapes.Cone().scale(2).pos(10,6).rotate_y(90, around=[10,6,0])
  50. fig += shapes.Text3D("MyTest3D", c='k', justify='center', font="Quikhand")\
  51. .pos(5,11).scale(0.5).rotate_z(20, around=[5,11,0])
  52. fig += shapes.Latex('sin(x^2)', res=150).scale(3).pos(10,0)
  53. fig2 = Figure([-2.5, 14],[-5,14], padding=0, title='Test Embedding Figure')
  54. fig2.insert(fig)
  55. import sys
  56. if len(sys.argv)>1:
  57. show(fig2, size=(1600, 1100), zoom='tight').close()