code: def plotind(
      self,
      iref,
      ind,
      subinds=None,
      upinds=None,
      downinds=None,
      masterax=None,
  ):
      sch = self.p.scheme
  
      # check subind
      subinds = subinds or []
      upinds = upinds or []
      downinds = downinds or []
  
      # plot subindicators on self with independent axis above
      for upind in upinds:
          self.plotind(iref, upind)
  
      # Get an axis for this plot
      ax = masterax or self.newaxis(
          ind, rowspan=self.pinf.sch.rowsminor
      )
  
      indlabel = ind.plotlabel()
  
      # Scan lines quickly to find out if some lines have to be skipped for
      # legend (because matplotlib reorders the legend)
      toskip = 0
      for lineidx in range(ind.size()):
          line = ind.lines[lineidx]
          linealias = ind.lines._getlinealias(lineidx)
          lineplotinfo = getattr(ind.plotlines, "_%d" % lineidx, None)
          if not lineplotinfo:
              lineplotinfo = getattr(ind.plotlines, linealias, None)
          if not lineplotinfo:
              lineplotinfo = AutoInfoClass()
          pltmethod = lineplotinfo._get("_method", "plot")
          if pltmethod != "plot":
              toskip += 1 - lineplotinfo._get("_plotskip", False)
  
      if toskip >= ind.size():
          toskip = 0
  
      for lineidx in range(ind.size()):
          line = ind.lines[lineidx]
          linealias = ind.lines._getlinealias(lineidx)
  
          lineplotinfo = getattr(ind.plotlines, "_%d" % lineidx, None)
          if not lineplotinfo:
              lineplotinfo = getattr(ind.plotlines, linealias, None)
  
          if not lineplotinfo:
              lineplotinfo = AutoInfoClass()
  
          if lineplotinfo._get("_plotskip", False):
              continue
  
          # Legend label only when plotting 1st line
          if masterax and not ind.plotinfo.plotlinelabels:
              label = indlabel * (not toskip) or "_nolegend"
          else:
              label = (indlabel + "\n") * (not toskip)
              label += lineplotinfo._get("_name", "") or linealias
  
          toskip -= 1  # one line less until legend can be added
  
          # plot data
          lplot = line.plotrange(self.pinf.xstart, self.pinf.xend)
  
          # Global and generic for indicator
          if self.pinf.sch.linevalues and ind.plotinfo.plotlinevalues:
              plotlinevalue = lineplotinfo._get("_plotvalue", True)
              if plotlinevalue and not math.isnan(lplot[-1]):
                  label += " %.2f" % lplot[-1]
  
          plotkwargs = dict()
          linekwargs = lineplotinfo._getkwargs(skip_=True)
  
          if linekwargs.get("color", None) is None:
              if not lineplotinfo._get("_samecolor", False):
                  self.pinf.nextcolor(ax)
              plotkwargs["color"] = self.pinf.color(ax)
  
          plotkwargs.update(dict(aa=True, label=label))
          plotkwargs.update(**linekwargs)
  
          if ax in self.pinf.zorder:
              plotkwargs["zorder"] = self.pinf.zordernext(ax)
  
          pltmethod = getattr(ax, lineplotinfo._get("_method", "plot"))
  
          xdata, lplotarray = self.pinf.xdata, lplot
          if lineplotinfo._get("_skipnan", False):
              # Get the full array and a mask to skipnan
              lplotarray = np.array(lplot)
              lplotmask = np.isfinite(lplotarray)
  
              # Get both the axis and the data masked
              lplotarray = lplotarray[lplotmask]
              xdata = np.array(xdata)[lplotmask]
  
          plottedline = pltmethod(xdata, lplotarray, **plotkwargs)
          try:
              plottedline = plottedline[0]
          except:
              # Possibly a container of artists (when plotting bars)
              pass
  
          self.pinf.zorder[ax] = plottedline.get_zorder()
  
          vtags = lineplotinfo._get("plotvaluetags", True)
          if self.pinf.sch.valuetags and vtags:
              linetag = lineplotinfo._get("_plotvaluetag", True)
              if linetag and not math.isnan(lplot[-1]):
                  # line has valid values, plot a tag for the last value
                  self.drawtag(
                      ax,
                      len(self.pinf.xreal),
                      lplot[-1],
                      facecolor=self.pinf.sch.locbgother,
                      edgecolor=self.pinf.color(ax),
                  )
  
          farts = (
              ("_gt", operator.gt),
              ("_lt", operator.lt),
              ("", None),
          )
          for fcmp, fop in farts:
              fattr = "_fill" + fcmp
              fref, fcol = lineplotinfo._get(fattr, (None, None))
              if fref is not None:
                  y1 = np.array(lplot)
                  if isinstance(fref, integer_types):
                      y2 = np.full_like(y1, fref)
                  else:  # string, naming a line, nothing else is supported
                      l2 = getattr(ind, fref)
                      prl2 = l2.plotrange(
                          self.pinf.xstart, self.pinf.xend
                      )
                      y2 = np.array(prl2)
                  kwargs = dict()
                  if fop is not None:
                      kwargs["where"] = fop(y1, y2)
  
                  falpha = self.pinf.sch.fillalpha
                  if isinstance(fcol, (list, tuple)):
                      fcol, falpha = fcol
  
                  ax.fill_between(
                      self.pinf.xdata,
                      y1,
                      y2,
                      facecolor=fcol,
                      alpha=falpha,
                      interpolate=True,
                      **kwargs,
                  )
  
      # plot subindicators that were created on self
      for subind in subinds:
          self.plotind(
              iref, subind, subinds=self.dplotsover[subind], masterax=ax
          )
  
      if not masterax:
          # adjust margin if requested ... general of particular
          ymargin = ind.plotinfo._get("plotymargin", 0.0)
          ymargin = max(ymargin, self.pinf.sch.yadjust)
          if ymargin:
              ax.margins(y=ymargin)
  
          # Set specific or generic ticks
          yticks = ind.plotinfo._get("plotyticks", [])
          if not yticks:
              yticks = ind.plotinfo._get("plotyhlines", [])
  
          if yticks:
              ax.set_yticks(yticks)
          else:
              locator = mticker.MaxNLocator(nbins=4, prune="both")
              ax.yaxis.set_major_locator(locator)
  
          # Set specific hlines if asked to
          hlines = ind.plotinfo._get("plothlines", [])
          if not hlines:
              hlines = ind.plotinfo._get("plotyhlines", [])
          for hline in hlines:
              ax.axhline(
                  hline,
                  color=self.pinf.sch.hlinescolor,
                  ls=self.pinf.sch.hlinesstyle,
                  lw=self.pinf.sch.hlineswidth,
              )
  
          if self.pinf.sch.legendind and ind.plotinfo._get(
              "plotlegend", True
          ):
              handles, labels = ax.get_legend_handles_labels()
              # Ensure that we have something to show
              if labels:
                  # location can come from the user
                  loc = (
                      ind.plotinfo.legendloc
                      or self.pinf.sch.legendindloc
                  )
  
                  # Legend done here to ensure it includes all plots
                  legend = ax.legend(
                      loc=loc,
                      numpoints=1,
                      frameon=False,
                      shadow=False,
                      fancybox=False,
                      prop=self.pinf.prop,
                  )
  
                  # legend.set_title(indlabel, prop=self.pinf.prop)
                  # hack: if title is set. legend has a Vbox for the labels
                  # which has a default "center" set
                  legend._legend_box.align = "left"
  
      # plot subindicators on self with independent axis below
      for downind in downinds:
          self.plotind(iref, downind)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import bisect
  import collections
  import datetime
  import itertools
  import math
  import operator
  import sys
  import matplotlib
  import numpy
  import matplotlib.dates
  import matplotlib.font_manager
  import matplotlib.legend
  import matplotlib.ticker
  from ..utils.py3 import range, with_metaclass, string_types, integer_types
  from ..None import AutoInfoClass, MetaParams, TimeFrame, date2num
  from .finance import plot_candlestick, plot_ohlc, plot_volume, plot_lineonclose
  from .formatters import MyVolFormatter, MyDateFormatter, getlocator
  from .None import locator
  from .multicursor import MultiCursor
  from .scheme import PlotScheme
  from .utils import tag_box_style
label_desc: Use image node_id 7 for calling the Plot_OldSync obj's underlying member method code with example usage: obj.plotind(iref, ind, subinds, upinds, downinds, masterax) without return types