Integrated Circuits

The schemdraw.elements.intcircuits.Ic class is used to make integrated circuits, multiplexers, and other black box elements. The schemdraw.elements.intcircuits.IcPin class is used to define each input/output pin before adding it to the Ic.

class schemdraw.elements.intcircuits.IcPin(**kwargs)

Define a single input/output pin for an integrated circuit or black box.

  • name (string) – Input/output name, drawn inside the box. A name of ‘>’ will be drawn as a proper clock input triangle.

  • pinname (string) – Pin name (usually a pin number), drawn outside the box

  • side (string) – Side of box for the pin, ‘left’, ‘right’, ‘top’, ‘bottom’ (or their first letter abbreviations)

  • pos (float) – Pin position as fraction from 0-1 along the side

  • slot (string) – Slot definition of pin location, given in ‘X/Y’ format. ‘2/4’ is the second pin on a side with 4 pins.

  • invert (bool) – Add in invert bubble to the pin

  • color (string or RGB tuple) – Color for the pin and label

  • rotation (float) – Rotation angle (degrees) for label text

  • anchorname (string) – Named anchor for this pin

class schemdraw.elements.intcircuits.Ic(**kwargs)

An integrated circuit or black box element

  • pins (list) – List if IcPin instances defining all the input/outputs

  • pinspacing (float) – Spacing between pins

  • edgepadH (float) – Padding between top/bottom and first pin

  • edgepadW (float) – Padding between left/right and first pin

  • lofst (float) – Offset between edge and label inside the box

  • lblsize (float) – Font size for labels inside the box

  • plblofst (float) – Offset between edge and pin label outside the box

  • plblsize (float) – Font size for pin labels outside the box

  • slant (float) – Slant angle of top/bottom edges (e.g. for multiplexers)

All pins will be given an anchor name of inXY where X is the side (L, R, T, B), and Y is the pin number along that side. Pins also define anchors based on the name parameter. If the anchorname parameter is provided for the pin, this name will be used, so that the pin name can be any string even if it cannot be used as a Python variable name.

Here, a J-K flip flop, as part of an HC7476 integrated circuit, is drawn with input names and pin numbers.

JK = elm.Ic(pins=[elm.IcPin(name='>', pin='1', side='left'),
                 elm.IcPin(name='K', pin='16', side='left'),
                 elm.IcPin(name='J', pin='4', side='left'),
                 elm.IcPin(name='$\overline{Q}$', pin='14', side='right', anchorname='QBAR'),
                 elm.IcPin(name='Q', pin='15', side='right')],
            edgepadW = .5,  # Make it a bit wider

Notice the use of $overline{Q}$ to acheive the label on the inverting output. The anchor positions can be accessed using attributes, such as JK.Q for the non-inverting output. However, inverting output is named $overline{Q}, which is not accessible using the typical dot notation. It could be accessed using getattr(JK, ‘$overline{Q}$’), but to avoid this an alternative anchorname of QBAR was defined.


Multiplexers and demultiplexers are drawn with the schemdraw.elements.intcircuits.Multiplexer class which wraps the Ic class.

class schemdraw.elements.intcircuits.Multiplexer(**kwargs)

Multiplexer or Demultiplexer element

  • slant (float) – Slant angle (degrees) of top and bottom edges

  • demux – Draw as demultiplexer

  • kwargs – Passed to Ic class

    pins=[elm.IcPin(name='C', side='L'),
          elm.IcPin(name='B', side='L'),
          elm.IcPin(name='A', side='L'),
          elm.IcPin(name='Q', side='R'),
          elm.IcPin(name='T', side='B', invert=True)],

See the Circuit Gallery for more examples.