NOTE: This package has been moved to Yao.jl as a component package: https://github.com/QuantumBFS/Yao.jl/tree/master/lib/YaoPlots
using Yao.EasyBuild, YaoPlots
# show a qft circuit
vizcircuit(qft_circuit(5))
If you are using a Pluto/Jupyter notebook, Atom/VSCode editor, you should see the following image in your plotting panel.
using YaoPlots, Yao
reg = zero_state(1) |> Rx(π/8) |> Rx(π/8)
rho = density_matrix(ghz_state(2), 1)
bloch_sphere("|ψ⟩"=>reg, "ρ"=>rho; show_projection_lines=true)
See more examples.
Various attributes of the visualizations can be altered. The plot can be modified, if we change the following attributes
YaoPlots.CircuitStyles.linecolor[]
for line color, default value being"#000000"
(black color)YaoPlots.CircuitStyles.gate_bgcolor[]
for background color of square blocks, the default value being"#FFFFFF"
(white color)YaoPlots.CircuitStyles.textcolor[]
for text color, default value being"#000000
YaoPlots.CircuitStyles.lw[]
for line width, default value being1
(pt)YaoPlots.CircuitStyles.textsize[]
for text size, default value being16
(pt)YaoPlots.CircuitStyles.paramtextsize[]
for parameter text size, for parameterized gates, default value being10
(pt)
For example,
using YaoPlots, Yao
YaoPlots.CircuitStyles.linecolor[] = "pink"
YaoPlots.CircuitStyles.gate_bgcolor[] = "yellow"
YaoPlots.CircuitStyles.textcolor[] = "#000080" # the navy blue color
YaoPlots.CircuitStyles.fontfamily[] = "JuliaMono"
YaoPlots.CircuitStyles.lw[] = 2.5
YaoPlots.CircuitStyles.textsize[] = 13
YaoPlots.CircuitStyles.paramtextsize[] = 8
vizcircuit(chain(3, put(1=>X), repeat(3, H), put(2=>Y), repeat(3, Rx(π/2))))