amazon-braket-sdk-python icon indicating copy to clipboard operation
amazon-braket-sdk-python copied to clipboard

Enable graphical visualizations for circuits

Open rmshaffer opened this issue 7 months ago • 8 comments

Describe the feature you'd like Build functionality to visualize a Circuit object using matplotlib and/or LaTeX. The interface and functionality should be similar to the Qiskit function qiskit.visualization.circuit_drawer, although it does not have to support all of the customizations at first.

Braket already supports text-based visualizations of Circuit objects. Existing implementations are in src/braket/circuits/text_diagram_builders, which should provide a good starting point for seeing how to get the relevant information out of the Circuit object.

At a minimum, an implementation of this feature should support either matplotlib or LaTeX (both would be great!), and should support visualizing everything currently supported by the text-based circuit visualization.

How would this feature be used? Please describe. This would allow Braket circuit visualizations to be much more readable, for example, in Jupyter notebooks, or for use on websites or in academic papers.

Describe alternatives you've considered The existing text-based visualization via print(circuit) works, but it is not very readable, and cannot be used as a graphical format for exporting a circuit.

rmshaffer avatar May 21 '25 01:05 rmshaffer

Hey @rmshaffer,

Good to see this issue here, I went through the hacker guide on unitaryHack and want to work on this.

I have previously worked on circuit visualizers similar to Qiskit's using Matplotlib, Plotly as well as using latex(quantikz and otherwise).

Please let me know if this issue is open and if I can work on it.

skushagra avatar May 28 '25 06:05 skushagra

Hi @skushagra, yes, this issue is open! Please feel free to start, and let us know if you have any questions.

rmshaffer avatar May 29 '25 23:05 rmshaffer

Please let me know what is your preffered method of implementation. Latex or matplotlib?

skushagra avatar May 30 '25 09:05 skushagra

I personally would choose LaTeX. But you're free to choose!

rmshaffer avatar May 30 '25 17:05 rmshaffer

Hello @rmshaffer

Sorry for replying a little late. I saw the PR raised with respect to this last week and decided to let them continue with the issue. I'll be happy to help wherever required!

skushagra avatar Jun 06 '25 10:06 skushagra

@skushagra thanks for checking in! @bryanhzaz, I know there's still a bit of work to do on your PR. If you think any help would be useful, please let us know!

rmshaffer avatar Jun 06 '25 14:06 rmshaffer

@rmshaffer if it works, I keep sharing my ideas on the PR. I think it will be helpful! Here for any help required. I'll work on some other issues on the repo meanwhile!

skushagra avatar Jun 06 '25 14:06 skushagra

Hi @rmshaffer,

The PR uses matplotlib to create the images. Please review at your convenience.

Qubit1718 avatar Jun 12 '25 02:06 Qubit1718