A better circuit_drawer (POC included) #24
EgrettaThula
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
POC repo: svg_circuit_drawer.
From readme:
An alternative circuit drawer for Qiskit with better performance and enhanced styling capabilities.
Two of the issues we faced while working on Qiskit timeline debugger were related to circuit drawer:
Qiskit circuit drawer uses Matplotlib to generate circuit plots. Matplotlib is the root cause of this bad performance. Although it makes great publication-quality graphics, Matplotlib's performance is not that good.
SVG is XML-based which means we can easily create SVG images in Python as any text files. And since all modern browsers supports SVG, we can use IPython.display.HTML to display it. Moreover, SVG supports interactivity and animation which open the door to advanced features as demonstrated in this project.
SVG circuit drawer is 8 times faster than Matplotlib-based drawer for qubits < 50 and depth < 150. The difference increases with circuit size. We get this performance without compromising the quality of the resulting graphics. The following graphs show how time scales with number of qubits and circuit depth for both drawers:
You can use all capabilities provided by CSS (the standard styling language) to style your circuit. test.ipynb notebook in the project's root directory contains some examples on this.
Beta Was this translation helpful? Give feedback.
All reactions