def __init__(self, qregs, cregs, ops, scale=1.0, style=None, plot_barriers=True, reverse_bits=False):
    if (not HAS_MATPLOTLIB):
        raise ImportError('The class MatplotlibDrawer needs matplotlib. Run "pip install matplotlib" before.')
    self._ast = None
    self._scale = (DEFAULT_SCALE * scale)
    self._creg = []
    self._qreg = []
    self._registers(cregs, qregs)
    self._ops = ops
    self._qreg_dict = collections.OrderedDict()
    self._creg_dict = collections.OrderedDict()
    self._cond = {'n_lines': 0, 'xmax': 0, 'ymax': 0}
    self._style = _qcstyle.QCStyle()
    self.plot_barriers = plot_barriers
    self.reverse_bits = reverse_bits
    if style:
        if isinstance(style, dict):
            self._style.set_style(style)
        elif isinstance(style, str):
            with open(style, 'r') as infile:
                dic = json.load(infile)
            self._style.set_style(dic)
    self.figure = plt.figure()
    self.figure.patch.set_facecolor(color=self._style.bg)
    self.ax = self.figure.add_subplot(111)
    self.ax.axis('off')
    self.ax.set_aspect('equal')
    self.ax.tick_params(labelbottom=False, labeltop=False, labelleft=False, labelright=False)
def __init__(self, qregs, cregs, ops, scale=1.0, style=None, plot_barriers=True, reverse_bits=False):
    if (not HAS_MATPLOTLIB):
        raise ImportError('The class MatplotlibDrawer needs matplotlib. Run "pip install matplotlib" before.')
    self._ast = None
    self._scale = (DEFAULT_SCALE * scale)
    self._creg = []
    self._qreg = []
    self._registers(cregs, qregs)
    self._ops = ops
    self._qreg_dict = collections.OrderedDict()
    self._creg_dict = collections.OrderedDict()
    self._cond = {'n_lines': 0, 'xmax': 0, 'ymax': 0}
    self._style = _qcstyle.QCStyle()
    self.plot_barriers = plot_barriers
    self.reverse_bits = reverse_bits
    if style:
        if isinstance(style, dict):
            self._style.set_style(style)
        elif isinstance(style, str):
            with open(style, 'r') as infile:
                dic = json.load(infile)
            self._style.set_style(dic)
    self.figure = plt.figure()
    self.figure.patch.set_facecolor(color=self._style.bg)
    self.ax = self.figure.add_subplot(111)
    self.ax.axis('off')
    self.ax.set_aspect('equal')
    self.ax.tick_params(labelbottom=False, labeltop=False, labelleft=False, labelright=False)