# Quantikz.jl for drawing quantum circuit diagrams with Julia

**URL:** <https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200>\
**Category:** Package Announcements\
**Tags:** announcement, quantum, plotting, latex\
**Created:** [December 21, 2020, 9:27pm UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200 "2020-12-21T21:27:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [December 21, 2020, 9:27pm UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/1 "2020-12-21T21:27:14Z")

</div>

[`quantikz`](https://arxiv.org/abs/1809.03842) is a great latex package for drawing quantum circuits. I have just released a small Julia package [Quantikz.jl](https://github.com/Krastanov/Quantikz) which harnesses `quantikz` to programmatically create circuit diagrams. If `pdflatex` is installed on your system, the diagrams can be viewed directly from the terminal or notebook.

You can see a small [examples notebook](https://github.com/Krastanov/Quantikz/blob/main/Quantikz.ipynb) for details.

The majority of the functionality is already implemented, but I could use some help in ensuring the package works on diverse systems (and has fallbacks if pdflatex is not available).

This is what its usage looks like:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/3/a3ed5bc916ad2a09c77e1b0eb4812c9957df9614.png)

The package is easy to use from inside of other quantum specific packages. The original reason for the creation of this package was the need to draw diagrams in my Clifford Circuit simulator [QuantumClifford.jl](https://github.com/Krastanov/QuantumClifford.jl). I will be making a real announcement about that much more interesting package soon.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [December 21, 2020, 9:30pm UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/2 "2020-12-21T21:30:05Z")

</div>

Very cool! You may be interested in [https://github.com/QuantumBFS/YaoPlots.jl](https://github.com/QuantumBFS/YaoPlots.jl) if you’re not aware of it.

---

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [December 21, 2020, 9:53pm UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/3 "2020-12-21T21:53:58Z")

</div>

Thanks, Mason! YaoPlots seems pretty difficult to find on google/duckduckgo, hence me not even knowing about it. Could you elaborate on how tightly it is coupled to Yao (how easy it is to use without knowing anything about Yao)?

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [December 21, 2020, 9:56pm UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/4 "2020-12-21T21:56:07Z")

</div>

I don’t actually know very much about Yao, and even less about YaoPlots. Perhaps @Roger-luo can comment.

---

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [December 21, 2020, 10:25pm UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/5 "2020-12-21T22:25:56Z")

</div>

It’s based on the pure Julia implementation of plotting package Compose.jl. The benefits of using Compose is everything is handled by Julia side and no need to configure LaTeX. Thus it works for all Julia development environments such as Pluto and vscode in RAM.

The Quantum Block IR is the basic foundation in Yao ecosystem it should be easy to understand. It provides a more composable way to define circuits. YaoPlots visualize this representation as well as ZX diagrams.

I see this as a good alternative since the quality of quantikz is quite good especially for publishing as long as the extra dependency is well handled, since users will need to configure tex if they want to use quantikz and it may be less interactive since there’s a layer of TeX.

* * *

I’d hope to have a common representation for circuits so write once run everywhere, e.g one can develop things using the Compose.jl backend and publish the results by generating quantikz. Would be nice if we can join effort on this.

> [@Krastanov](#):
>
> Thanks, Mason! YaoPlots seems pretty difficult to find on google/duckduckgo, hence me not even knowing about it.

we didn’t announce this package yet since it’s still at early stage so we hope to use it in a small group of users first so that we can bring this more mature stage. In principal all the packages start with `Yao` are intended to be included in the meta package `Yao.jl` when they are mature.

---

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [December 22, 2020, 12:39am UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/6 "2020-12-22T00:39:50Z")

</div>

Thanks for the details! I have now added `YaoPlots` to the readme at [https://github.com/Krastanov/Quantikz](https://github.com/Krastanov/Quantikz)  
Let me know if you feel the description is imprecise.

---

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [December 22, 2020, 12:45am UTC](https://discourse.julialang.org/t/quantikz-jl-for-drawing-quantum-circuit-diagrams-with-julia/52200/7 "2020-12-22T00:45:34Z")

</div>

thanks for mentioning it! I’d be interested to compile our representation to Quantikz’s IR to get publish quality plotting in TeX at some point too, so we don’t need to define circuits in separate places.
