code: def plot_ret_range(self, ax=None, ls=0, dur=0):
          
          import matplotlib.pyplot as plt
          from tia.util.mplot import AxesFormat
  
          if ax is None:
              ax = plt.gca()
  
          frame = self.frame
          pids = frame.index
  
          min_rets = pd.Series([self[pid].performance.ltd_txn.min() for pid in pids], index=pids)
          max_rets = pd.Series([self[pid].performance.ltd_txn.max() for pid in pids], index=pids)
  
          if not ls:
              s = frame.duration + 20 if dur else 20
              ax.scatter(frame.index, frame.ret, s=s, c='k', marker='o', label='All')
              ax.vlines(pids, min_rets, max_rets)
          else:
              if len(self.long_pids) > 0:
                  lframe = frame.ix[frame.index.isin(self.long_pids)]
                  s = lframe.duration + 20 if dur else 20
                  ax.scatter(lframe.index, lframe.ret, s=s, c='k', marker='o', label='Long')
                  ax.vlines(lframe.index, min_rets[lframe.index], max_rets[frame.index])
              if len(self.short_pids) > 0:
                  sframe = frame.ix[frame.index.isin(self.short_pids)]
                  s = sframe.duration + 20 if dur else 20
                  ax.scatter(sframe.index, sframe.ret, s=s, c='r', marker='o', label='Short')
                  ax.vlines(sframe.index, min_rets[sframe.index], max_rets[sframe.index])
  
          AxesFormat().Y.percent().apply()
          ax.axhline(color='k', linestyle='--')
          ax.set_xlim(0, frame.index.max() + 3)
          ax.set_xlabel('pid')
          ax.set_ylabel('return')
          ax.legend(loc='upper left')
          return ax
docs: Plot the return range for each position
  
          :param ax: Axes