code: def _draw_projection(
      x, cost, scale=True, shift=False, style=None, figure=None
  ):
      """draw a solution trajectory (for overlay on a 1D plot)
  
      x is the sequence of values for one parameter (i.e. a parameter trajectory)
      cost is the sequence of costs (i.e. the solution trajectory)
      if scale is provided, scale the intensity as 'z = log(4*z*scale+1)+2'
      if shift is provided, shift the intensity as 'z = z+shift' (useful for -z's)
      if style is provided, set the line style (e.g. 'w-o', 'k-', 'ro')
      if figure is provided, plot to an existing figure
      """
      import matplotlib.pyplot as plt
  
      if not figure:
          figure = plt.figure()
      ax = figure.gca()
      ax.autoscale(tight=True)
  
      if style in [None, False]:
          style = "k-o"
      import numpy
  
      if shift:
          if shift is True:  # NOTE: MAY NOT be the exact minimum
              shift = max(-numpy.min(cost), 0.0) + 0.5  # a good guess
          cost = numpy.asarray(cost) + shift
      cost = numpy.asarray(cost)
      if scale:
          cost = numpy.log(4 * cost * scale + 1) + 2
  
      ax.plot(x, cost, style, linewidth=2, markersize=4)
      # XXX: need to 'correct' the z-axis (or provide easy conversion)
      return figure
  
imports: from collections.abc import Callable
label_desc: Use image node_id 22 for calling a global function with example usage: _draw_projection(x, cost, scale, shift, style, figure) and returns: figure