cirq.draw_gridlike

Draw a grid-like graph using Matplotlib.

Used in the notebooks

Used in the tutorials

This wraps nx.draw_networkx to produce a matplotlib drawing of the graph. Nodes should be two-dimensional gridlike objects.

graph A NetworkX graph whose nodes are (row, column) coordinates or cirq.GridQubits.
ax Optional matplotlib axis to use for drawing.
tilted If True, directly position as (row, column); otherwise, rotate 45 degrees to accommodate google-style diagonal grids.
**kwargs Additional arguments to pass to nx.draw_networkx.

A positions dictionary mapping nodes to (x, y) coordinates suitable for future calls to NetworkX plotting functionality.