plotter_2.py 816 B

1234567891011121314151617181920212223242526
  1. def plotIn2D(LHStok, RHStok, variables, axisRange):
  2. """Returns function array for 2D plots
  3. Arguments:
  4. LHStok {list} -- expression tokens
  5. RHStok {list} -- expression tokens
  6. variables {list} -- variables in equation
  7. axisRange {list} -- axis limits
  8. Returns:
  9. graphVars {list} -- variables for plotting
  10. func {numpy.array} -- equation to be plotted in 2D
  11. """
  12. xmin = -axisRange[0]
  13. xmax = axisRange[0]
  14. ymin = -axisRange[1]
  15. ymax = axisRange[1]
  16. xdelta = 0.01 * (xmax - xmin)
  17. ydelta = 0.01 * (ymax - ymin)
  18. xrange = np.arange(xmin, xmax, xdelta)
  19. yrange = np.arange(ymin, ymax, ydelta)
  20. graphVars = np.meshgrid(xrange, yrange)
  21. function = getFunction(LHStok, RHStok, variables, graphVars, 2)
  22. return graphVars, function