class_docstr: Allows easy creation of graphics representing circuits with matplotlib
  
  Args:
      n_layers (int): the number of layers
      n_wires (int): the number of wires
  
  Keyword Args:
      c_wires=0 (int): the number of classical wires to leave space for.
      wire_options=None (dict): matplotlib configuration options for drawing the wire lines
      figsize=None (Iterable): Allows users to specify the size of the figure manually. Defaults
          to scale with the size of the circuit via ``n_layers`` and ``n_wires``.
      fig=None (matplotlib Figure): Allows users to specify the figure window to plot to.
  
  **Example**
  
  .. code-block:: python
  
      drawer = qml.drawer.MPLDrawer(n_wires=5, n_layers=6)
  
      drawer.label(["0", "a", r"$|\Psi\rangle$", r"$|\theta\rangle$", "aux"])
  
      drawer.box_gate(layer=0, wires=[0, 1, 2, 3, 4], text="Entangling Layers")
      drawer.box_gate(layer=1, wires=[0, 2, 3], text="U(θ)")
  
      drawer.box_gate(layer=1, wires=4, text="Z")
  
      drawer.SWAP(layer=2, wires=(3,4))
      drawer.CNOT(layer=2, wires=(0, 2))
  
      drawer.ctrl(layer=3, wires=[1, 3], control_values=[True, False])
      drawer.box_gate(
          layer=3, wires=2, text="H", box_options={"zorder": 4}, text_options={"zorder": 5}
      )
  
      drawer.ctrl(layer=4, wires=[1, 2])
  
      drawer.measure(layer=5, wires=0)
  
      drawer.fig.suptitle('My Circuit', fontsize='xx-large')
  
  .. figure:: ../../_static/drawer/example_basic.png
          :align: center
          :width: 60%
          :target: javascript:void(0);
  
  .. details::
      :title: Usage Details
  
  **Matplotlib Integration**
  
  This class relies on matplotlib. As such, users can extend this class via interacting with the figure
  ``drawer.fig`` and axes ``drawer.ax`` objects manually. For instance, the example circuit manipulates the
  figure to set a title using ``drawer.fig.suptitle``. Users can save the image using ``plt.savefig`` or via
  the figure method ``drawer.fig.savefig``.
  
  As described in the next section, the figure supports both global styling and individual styling of
  elements with matplotlib styles, configuration, and keywords.
  
  **Formatting**
  
  PennyLane has inbuilt styles for controlling the appearance of the circuit drawings.
  All available styles can be determined by evaluating ``qml.drawer.available_styles()``.
  Any available string can then be passed to ``qml.drawer.use_style``.
  
  .. code-block:: python
  
      qml.drawer.use_style('black_white')
  
  .. figure:: ../../_static/drawer/black_white_style.png
          :align: center
          :width: 60%
          :target: javascript:void(0);
  
  You can also control the appearance with matplotlib's provided tools, see the
  `matplotlib docs <https://matplotlib.org/stable/tutorials/introductory/customizing.html>`_ .
  For example, we can customize ``plt.rcParams``:
  
  .. code-block:: python
  
      plt.rcParams['patch.facecolor'] = 'mistyrose'
      plt.rcParams['patch.edgecolor'] = 'maroon'
      plt.rcParams['text.color'] = 'maroon'
      plt.rcParams['font.weight'] = 'bold'
      plt.rcParams['patch.linewidth'] = 4
      plt.rcParams['patch.force_edgecolor'] = True
      plt.rcParams['lines.color'] = 'indigo'
      plt.rcParams['lines.linewidth'] = 5
      plt.rcParams['figure.facecolor'] = 'ghostwhite'
  
  
  .. figure:: ../../_static/drawer/example_rcParams.png
          :align: center
          :width: 60%
          :target: javascript:void(0);
  
  You can also manually control the styles of individual plot elements via the drawer class.
  All accept dictionaries of keyword-values pairs for matplotlib object
  components. Acceptable keywords differ based on what's being drawn. For example, you cannot pass ``"fontsize"``
  to the dictionary controlling how to format a rectangle. For the control-type gates ``CNOT`` and
  ``ctrl`` the options dictionary can only contain ``'linewidth'``, ``'color'``, or ``'zorder'`` keys.
  
  This example demonstrates the different ways you can format the individual elements:
  
  .. code-block:: python
  
      wire_options = {"color": "indigo", "linewidth": 4}
      drawer = MPLDrawer(n_wires=2, n_layers=4, wire_options=wire_options)
  
      label_options = {"fontsize": "x-large", 'color': 'indigo'}
      drawer.label(["0", "a"], text_options=label_options)
  
      box_options = {'facecolor': 'lightcoral', 'edgecolor': 'maroon', 'linewidth': 5}
      text_options = {'fontsize': 'xx-large', 'color': 'maroon'}
      drawer.box_gate(layer=0, wires=0, text="Z", box_options=box_options, text_options=text_options)
  
      swap_options = {'linewidth': 4, 'color': 'darkgreen'}
      drawer.SWAP(layer=1, wires=(0, 1), options=swap_options)
  
      ctrl_options = {'linewidth': 4, 'color': 'teal'}
      drawer.CNOT(layer=2, wires=(0, 1), options=ctrl_options)
      drawer.ctrl(layer=3, wires=(0, 1), options=ctrl_options)
  
  
      measure_box = {'facecolor': 'white', 'edgecolor': 'indigo'}
      measure_lines = {'edgecolor': 'indigo', 'facecolor': 'plum', 'linewidth': 2}
      for wire in range(2):
          drawer.measure(layer=4, wires=wire, box_options=measure_box, lines_options=measure_lines)
  
      drawer.fig.suptitle('My Circuit', fontsize='xx-large')
  
  .. figure:: ../../_static/drawer/example_formatted.png
          :align: center
          :width: 60%
          :target: javascript:void(0);
  
  **Positioning**
  
  Each gate takes arguments in order of ``layer`` followed by ``wires``. These translate to ``x`` and
  ``y`` coordinates in the graph. Layer number (``x``) increases as you go right, and wire number
  (``y``) increases as you go down; the y-axis is inverted. You can pass non-integer values to either keyword.
  If you have a long label, the gate can span multiple layers and have extra width:
  
  .. code-block:: python
  
      drawer = MPLDrawer(2, 2)
      drawer.box_gate(layer=0, wires=1, text="X")
      drawer.box_gate(layer=1, wires=1, text="Y")
  
      # Gate between two layers
      drawer.box_gate(layer=0.5, wires=0, text="Big Gate", extra_width=0.5)
  
  .. figure:: ../../_static/drawer/float_layer.png
          :align: center
          :width: 60%
          :target: javascript:void(0);
class_docstr_tok: ["Allows","easy","creation","of","graphics","representing","circuits","with","matplotlib","Args",":","n_layers","(","int",")",":","the","number","of","layers","n_wires","(","int",")",":","the","number","of","wires","Keyword","Args",":","c_wires=0","(","int",")",":","the","number","of","classical","wires","to","leave","space","for",".","wire_options=None","(","dict",")",":","matplotlib","configuration","options","for","drawing","the","wire","lines","figsize=None","(","Iterable",")",":","Allows","users","to","specify","the","size","of","the","figure","manually",".","Defaults","to","scale","with","the","size","of","the","circuit","via","``","n_layers","``","and","``","n_wires","``",".","fig=None","(","matplotlib","Figure",")",":","Allows","users","to","specify","the","figure","window","to","plot","to",".","*","*","Example","*","*","..","code-block",":",":","python","drawer","=","qml.drawer.MPLDrawer","(","n_wires=5",",","n_layers=6",")","drawer.label","(","[","``","0","''",",","``","a","''",",","r","''","$","|\\Psi\\rangle","$","''",",","r","''","$","|\\theta\\rangle","$","''",",","``","aux","''","]",")","drawer.box_gate","(","layer=0",",","wires=","[","0",",","1",",","2",",","3",",","4","]",",","text=","''","Entangling","Layers","''",")","drawer.box_gate","(","layer=1",",","wires=","[","0",",","2",",","3","]",",","text=","''","U","(","\u03b8",")","''",")","drawer.box_gate","(","layer=1",",","wires=4",",","text=","''","Z","''",")","drawer.SWAP","(","layer=2",",","wires=","(","3,4",")",")","drawer.CNOT","(","layer=2",",","wires=","(","0",",","2",")",")","drawer.ctrl","(","layer=3",",","wires=","[","1",",","3","]",",","control_values=","[","True",",","False","]",")","drawer.box_gate","(","layer=3",",","wires=2",",","text=","''","H","''",",","box_options=","{","``","zorder","''",":","4","}",",","text_options=","{","``","zorder","''",":","5","}",")","drawer.ctrl","(","layer=4",",","wires=","[","1",",","2","]",")","drawer.measure","(","layer=5",",","wires=0",")","drawer.fig.suptitle","(","'My","Circuit","'",",","fontsize='xx-large","'",")","..","figure",":",":","..","\/","..","\/_static\/drawer\/example_basic.png",":","align",":","center",":","width",":","60","%",":","target",":","javascript",":","void","(","0",")",";","..","details",":",":",":","title",":","Usage","Details","*","*","Matplotlib","Integration","*","*","This","class","relies","on","matplotlib",".","As","such",",","users","can","extend","this","class","via","interacting","with","the","figure","``","drawer.fig","``","and","axes","``","drawer.ax","``","objects","manually",".","For","instance",",","the","example","circuit","manipulates","the","figure","to","set","a","title","using","``","drawer.fig.suptitle","``",".","Users","can","save","the","image","using","``","plt.savefig","``","or","via","the","figure","method","``","drawer.fig.savefig","``",".","As","described","in","the","next","section",",","the","figure","supports","both","global","styling","and","individual","styling","of","elements","with","matplotlib","styles",",","configuration",",","and","keywords",".","*","*","Formatting","*","*","PennyLane","has","inbuilt","styles","for","controlling","the","appearance","of","the","circuit","drawings",".","All","available","styles","can","be","determined","by","evaluating","``","qml.drawer.available_styles","(",")","``",".","Any","available","string","can","then","be","passed","to","``","qml.drawer.use_style","``",".","..","code-block",":",":","python","qml.drawer.use_style","(","'black_white","'",")","..","figure",":",":","..","\/","..","\/_static\/drawer\/black_white_style.png",":","align",":","center",":","width",":","60","%",":","target",":","javascript",":","void","(","0",")",";","You","can","also","control","the","appearance","with","matplotlib","'s","provided","tools",",","see","the","`","matplotlib","docs","<","https",":","\/\/matplotlib.org\/stable\/tutorials\/introductory\/customizing.html",">","`","_",".","For","example",",","we","can","customize","``","plt.rcParams","``",":","..","code-block",":",":","python","plt.rcParams","[","'patch.facecolor","'","]","=","'mistyrose'","plt.rcParams","[","'patch.edgecolor","'","]","=","'maroon'","plt.rcParams","[","'text.color","'","]","=","'maroon'","plt.rcParams","[","'font.weight","'","]","=","'bold'","plt.rcParams","[","'patch.linewidth","'","]","=","4","plt.rcParams","[","'patch.force_edgecolor","'","]","=","True","plt.rcParams","[","'lines.color","'","]","=","'indigo'","plt.rcParams","[","'lines.linewidth","'","]","=","5","plt.rcParams","[","'figure.facecolor","'","]","=","'ghostwhite'","..","figure",":",":","..","\/","..","\/_static\/drawer\/example_rcParams.png",":","align",":","center",":","width",":","60","%",":","target",":","javascript",":","void","(","0",")",";","You","can","also","manually","control","the","styles","of","individual","plot","elements","via","the","drawer","class",".","All","accept","dictionaries","of","keyword-values","pairs","for","matplotlib","object","components",".","Acceptable","keywords","differ","based","on","what","'s","being","drawn",".","For","example",",","you","can","not","pass","``","``","fontsize","''","``","to","the","dictionary","controlling","how","to","format","a","rectangle",".","For","the","control-type","gates","``","CNOT","``","and","``","ctrl","``","the","options","dictionary","can","only","contain","``","'linewidth","'","``",",","``","'color","'","``",",","or","``","'zorder","'","``","keys",".","This","example","demonstrates","the","different","ways","you","can","format","the","individual","elements",":","..","code-block",":",":","python","wire_options","=","{","``","color","''",":","``","indigo","''",",","``","linewidth","''",":","4","}","drawer","=","MPLDrawer","(","n_wires=2",",","n_layers=4",",","wire_options=wire_options",")","label_options","=","{","``","fontsize","''",":","``","x-large","''",",","'color","'",":","'indigo","'","}","drawer.label","(","[","``","0","''",",","``","a","''","]",",","text_options=label_options",")","box_options","=","{","'facecolor","'",":","'lightcoral","'",",","'edgecolor","'",":","'maroon","'",",","'linewidth","'",":","5","}","text_options","=","{","'fontsize","'",":","'xx-large","'",",","'color","'",":","'maroon","'","}","drawer.box_gate","(","layer=0",",","wires=0",",","text=","''","Z","''",",","box_options=box_options",",","text_options=text_options",")","swap_options","=","{","'linewidth","'",":","4",",","'color","'",":","'darkgreen","'","}","drawer.SWAP","(","layer=1",",","wires=","(","0",",","1",")",",","options=swap_options",")","ctrl_options","=","{","'linewidth","'",":","4",",","'color","'",":","'teal","'","}","drawer.CNOT","(","layer=2",",","wires=","(","0",",","1",")",",","options=ctrl_options",")","drawer.ctrl","(","layer=3",",","wires=","(","0",",","1",")",",","options=ctrl_options",")","measure_box","=","{","'facecolor","'",":","'white","'",",","'edgecolor","'",":","'indigo","'","}","measure_lines","=","{","'edgecolor","'",":","'indigo","'",",","'facecolor","'",":","'plum","'",",","'linewidth","'",":","2","}","for","wire","in","range","(","2",")",":","drawer.measure","(","layer=4",",","wires=wire",",","box_options=measure_box",",","lines_options=measure_lines",")","drawer.fig.suptitle","(","'My","Circuit","'",",","fontsize='xx-large","'",")","..","figure",":",":","..","\/","..","\/_static\/drawer\/example_formatted.png",":","align",":","center",":","width",":","60","%",":","target",":","javascript",":","void","(","0",")",";","*","*","Positioning","*","*","Each","gate","takes","arguments","in","order","of","``","layer","``","followed","by","``","wires","``",".","These","translate","to","``","x","``","and","``","y","``","coordinates","in","the","graph",".","Layer","number","(","``","x","``",")","increases","as","you","go","right",",","and","wire","number","(","``","y","``",")","increases","as","you","go","down",";","the","y-axis","is","inverted",".","You","can","pass","non-integer","values","to","either","keyword",".","If","you","have","a","long","label",",","the","gate","can","span","multiple","layers","and","have","extra","width",":","..","code-block",":",":","python","drawer","=","MPLDrawer","(","2",",","2",")","drawer.box_gate","(","layer=0",",","wires=1",",","text=","''","X","''",")","drawer.box_gate","(","layer=1",",","wires=1",",","text=","''","Y","''",")","#","Gate","between","two","layers","drawer.box_gate","(","layer=0.5",",","wires=0",",","text=","''","Big","Gate","''",",","extra_width=0.5",")","..","figure",":",":","..","\/","..","\/_static\/drawer\/float_layer.png",":","align",":","center",":","width",":","60","%",":","target",":","javascript",":","void","(","0",")",";"]
docstr: Erase the horizontal edges of an intersection between classical wires. By default, erases
  only the left edge.
  
  Args:
      layer: the x-coordinate for the classical wire intersection
      wire: the classical wire y-coordinate for the intersection
      erase_right=False(bool):  whether or not to erase the right side of the intersection
          in addition to the left.
docstr_tok: ["Erase","the","horizontal","edges","of","an","intersection","between","classical","wires",".","By","default",",","erases","only","the","left","edge",".","Args",":","layer",":","the","x-coordinate","for","the","classical","wire","intersection","wire",":","the","classical","wire","y-coordinate","for","the","intersection","erase_right=False","(","bool",")",":","whether","or","not","to","erase","the","right","side","of","the","intersection","in","addition","to","the","left","."]
code: def cwire_join(self, layer, wire, erase_right=False):
      """Erase the horizontal edges of an intersection between classical wires. By default, erases
      only the left edge.
  
      Args:
          layer: the x-coordinate for the classical wire intersection
          wire: the classical wire y-coordinate for the intersection
          erase_right=False(bool):  whether or not to erase the right side of the intersection
              in addition to the left.
  
      """
      xs = (
          (layer - 0.2, layer + 0.2)
          if erase_right
          else (layer - 0.2, layer)
      )
      line = plt.Line2D(
          xs,
          (self._y(wire), self._y(wire)),
          zorder=2,
          color=plt.rcParams["figure.facecolor"],
          linewidth=3
          * plt.rcParams[
              "lines.linewidth"
          ],  # match inner_stroke from classical_wire
      )
      self.ax.add_line(line)
  
imports: from collections.abc import Iterable
  import warnings
  from typing import Sequence
label_desc: Use image node_id 21 for calling the MPLDrawer obj's underlying member method code with example usage: obj.cwire_join(layer, wire, erase_right) without return types