code: def build_plot(profilerResults):
      # Calculate each value.
      x = []
      mean = []
      std = []
      for t in xrange(
          profilerResults.getLookBack() * -1,
          profilerResults.getLookForward() + 1,
      ):
          x.append(t)
          values = np.asarray(profilerResults.getValues(t))
          mean.append(values.mean())
          std.append(values.std())
  
      # Cleanup
      plt.clf()
      # Plot a line with the mean cumulative returns.
      plt.plot(x, mean, color="#0000FF")
  
      # Error bars starting on the first lookforward period.
      lookBack = profilerResults.getLookBack()
      firstLookForward = lookBack + 1
      plt.errorbar(
          x=x[firstLookForward:],
          y=mean[firstLookForward:],
          yerr=std[firstLookForward:],
          capsize=3,
          ecolor="#AAAAFF",
          alpha=0.5,
      )
  
      # Horizontal line at the level of the first cumulative return.
      plt.axhline(
          y=mean[lookBack],
          xmin=-1 * profilerResults.getLookBack(),
          xmax=profilerResults.getLookForward(),
          color="#000000",
      )
  
      plt.xlim(
          profilerResults.getLookBack() * -1 - 0.5,
          profilerResults.getLookForward() + 0.5,
      )
      plt.xlabel("Time")
      plt.ylabel("Cumulative returns")
  
imports: import numpy
  import matplotlib.pyplot
  from six.moves import xrange
  from pyalgotrade.technical import roc
  from pyalgotrade import dispatcher
label_desc: Use image node_id 1 for calling a global function with example usage: build_plot(profilerResults) without return types