cirq.draw_gridlike
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]