feat: add interactive Plotly circuit diagram visualization#1284
Open
kawacukennedy wants to merge 1 commit into
Open
Conversation
…aket#1250) Implements PlotlyCircuitDiagram — an interactive circuit diagram renderer that returns a plotly.graph_objects.Figure via the existing circuit.show() interface (use show('interactive')). - Gate boxes, control dots, connections, barriers, SWAP, result types - Hover tooltips with gate name, target qubits, parameters - Collapsible verbatim boxes via Plotly updatemenus - Optional dependency: pip install amazon-braket-sdk[interactive] - 68 unit tests matching the Matplotlib test pattern - Example script in examples/plotly_circuit_visualization.py Co-authored-by: AI (big-pickle)
Author
|
👋 Hi team — this PR adds interactive Plotly-based circuit diagram visualization to the SDK (resolves #1250). Key highlights:
Would love a review when someone has a chance! @speller26 @krneta |
This was referenced Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
PlotlyCircuitDiagram— an interactive circuit diagram renderer that returns aplotly.graph_objects.Figurevia the existingcircuit.show()interface. Resolves #1250.Changes
src/braket/circuits/graphical_diagram_builders/plotly_circuit_diagram.py— Full Plotly rendering: gate boxes, control/anti-control dots, SWAP markers, connections, barriers, result types, qubit labels, moment labels, footer metadatatest/unit_tests/braket/circuits/test_plotly_circuit_diagram.py— 68 tests covering layout, tooltips, verbatim detection, column geometry, and figure outputexamples/plotly_circuit_visualization.py— Usage examples including parameterized circuits, verbatim boxes, result types, and HTML exportsrc/braket/circuits/circuit.py—show()accepts"interactive"argument, imports PlotlyCircuitDiagram on demandsrc/braket/circuits/graphical_diagram_builders/__init__.py— ExportPlotlyCircuitDiagrampyproject.toml— Addedinteractive = ["plotly"]optional dependency groupKey Features
updatemenustoggle (collapsed by default)pip install amazon-braket-sdk[interactive]Testing
Disclosure
This contribution includes code co-authored with an AI assistant (big-pickle).