cirq.TextDiagramDrawer

class cirq.TextDiagramDrawer(entries: Optional[Mapping[Tuple[int, int], cirq.circuits.text_diagram_drawer.DiagramText]] = None, horizontal_lines: Optional[Iterable[cirq.circuits.text_diagram_drawer.HorizontalLine]] = None, vertical_lines: Optional[Iterable[cirq.circuits.text_diagram_drawer.VerticalLine]] = None, horizontal_padding: Optional[Mapping[int, int]] = None, vertical_padding: Optional[Mapping[int, int]] = None)[source]

A utility class for creating simple text diagrams.

__init__(entries: Optional[Mapping[Tuple[int, int], cirq.circuits.text_diagram_drawer.DiagramText]] = None, horizontal_lines: Optional[Iterable[cirq.circuits.text_diagram_drawer.HorizontalLine]] = None, vertical_lines: Optional[Iterable[cirq.circuits.text_diagram_drawer.VerticalLine]] = None, horizontal_padding: Optional[Mapping[int, int]] = None, vertical_padding: Optional[Mapping[int, int]] = None) → None[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

content_present(x, y)

Determines if a line or printed text is at the given location.

copy()

force_horizontal_padding_after(index, padding)

Change the padding after the given column.

force_vertical_padding_after(index, padding)

Change the padding after the given row.

grid_line(x1, y1, x2, y2[, emphasize])

Adds a vertical or horizontal line from (x1, y1) to (x2, y2).

height()

Determines how many entry rows are in the diagram.

horizontal_line(y, x1, x2[, emphasize])

Adds a line from (x1, y) to (x2, y).

hstack(diagrams[, padding_resolver])

Horizontally stack text diagrams.

insert_empty_columns(x[, amount])

Insert a number of columns after the given column.

insert_empty_rows(y[, amount])

Insert a number of rows after the given row.

render([horizontal_spacing, …])

Outputs text containing the diagram.

shift([dx, dy])

shifted([dx, dy])

superimpose(other)

superimposed(other)

transpose()

Returns the same diagram, but mirrored across its diagonal.

vertical_line(x, y1, y2[, emphasize])

Adds a line from (x, y1) to (x, y2).

vstack(diagrams[, padding_resolver])

Vertically stack text diagrams.

width()

Determines how many entry columns are in the diagram.

write(x, y, text[, transposed_text])

Adds text to the given location.