Draw a grid-like graph using Matplotlib.
cirq.draw_gridlike(
graph: nx.Graph,
ax: Optional[plt.Axes] = None,
tilted: bool = True,
**kwargs
) -> Dict[Any, Tuple[int, int]]
Used in the notebooks
This wraps nx.draw_networkx to produce a matplotlib drawing of the graph. Nodes
should be two-dimensional gridlike objects.
Args |
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 .
|
Returns |
A positions dictionary mapping nodes to (x, y) coordinates suitable for future calls
to NetworkX plotting functionality.
|