custom_axes1.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """Customizing axes style
  2. (40+ control parameters!)
  3. Title font: """
  4. from vedo import Box, Lines, Points, Spline, show, settings
  5. settings.default_font = 'Theemim'
  6. # an invisible box:
  7. world = Box(pos=(2.7,0,0), size=(12,10,8), alpha=0)
  8. # a dummy spline with its shadow on the xy plane
  9. pts = Points([(-2,-3.2,-1.5), (3,-1.2,-2), (7,3,4)], r=12)
  10. spl = Spline(pts, res=50) # make a spline from points
  11. spl.add_shadow(plane='z', point=-4) # add its shadow at z=-4
  12. lns = Lines(spl, spl.shadows[0]) # join spline points with its own shadow
  13. # make a dictionary of axes options
  14. axes_opts = dict(
  15. xtitle='My variable :Omega^:lowerxi_lm in units of :mum^3', # latex-style syntax
  16. ytitle='This is my highly\ncustomized y-axis',
  17. ztitle='z in units of Å', # many unicode chars are supported (type: vedo -r fonts)
  18. y_values_and_labels=[(-3.2,'Mark^a_-3.2'), (-1.2,'Carmen^b_-1.2'), (3,'John^c_3')],
  19. text_scale=1.3, # make all text 30% bigger
  20. number_of_divisions=5, # approximate number of divisions on longest axis
  21. axes_linewidth= 2,
  22. grid_linewidth= 1,
  23. zxgrid2=True, # show zx plane on opposite side of the bounding box
  24. yzgrid2=True, # show yz plane on opposite side of the bounding box
  25. xyplane_color='green7',
  26. xygrid_color='green3', # darkgreen line color
  27. xyalpha=0.2, # grid opacity
  28. xtitle_position=0.5, # title fractional positions along axis
  29. xtitle_justify="top-center", # align title wrt to its axis
  30. ytitle_size=0.02,
  31. ytitle_box=True,
  32. ytitle_offset=0.05,
  33. ylabel_offset=0.4,
  34. yhighlight_zero=True, # draw a line highlighting zero position if in range
  35. yhighlight_zero_color='red',
  36. zline_color='blue5',
  37. ztitle_color='blue5',
  38. ztitle_backface_color='v',# violet color of axis title backface
  39. label_font="Quikhand",
  40. ylabel_size=0.025, # size of the numeric labels along Y axis
  41. ylabel_color='green4', # color of the numeric labels along Y axis
  42. )
  43. show(world, pts, spl, lns, __doc__+settings.default_font, axes=axes_opts).close()