Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix #58
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu committed Sep 22, 2022
1 parent 67a79c2 commit d6dddbb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "YaoPlots"
uuid = "32cfe2d9-419e-45f2-8191-2267705d8dbc"
version = "0.8.0"
version = "0.8.1"

[deps]
Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
Expand Down
2 changes: 1 addition & 1 deletion examples/circuits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ vizcircuit(chain(5, [put(5, 2=>ConstGate.Sdag), put(5, 3=>ConstGate.Tdag),
put(5, (2,)=>shift(0.4π)),
]), filename=joinpath(@__DIR__, "constgates.png"))

vizcircuit(chain(5, [put(5, (2,3)=>matblock(Matrix(SWAP), tag="SWAP")'), put(5, 2=>matblock(mat(I2), tag="id")), put(5, 2=>addlabel(X, "X")), control(5, (5,3), (2,4,1)=>put(3, (1,3)=>addlabel(SWAP, "SWAP")))]), filename=joinpath(@__DIR__, "multiqubit.png"))
vizcircuit(chain(5, [put(5, (2,3)=>matblock(Matrix(SWAP), tag="SWAP")'), put(5, 2=>matblock(mat(I2), tag="id")), put(5, 2=>addlabel(X, "Xr")), control(5, (5,3), (2,4,1)=>put(3, (1,3)=>addlabel(SWAP, "SWAP")))]), filename=joinpath(@__DIR__, "multiqubit.png"))

YaoPlots.darktheme!()
YaoPlots.CircuitStyles.gate_bgcolor[] = "transparent" # default is transparent
Expand Down
Binary file modified examples/multiqubit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/helperblock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,18 @@ YaoBlocks.Optimise.to_basictypes(block::LabelBlock) = block
export addlabel
addlabel(b::AbstractBlock, str::String) = LabelBlock(b, str)

# to fix issue
function YaoBlocks.print_tree(
io::IO,
root::AbstractBlock,
node::LabelBlock,
depth::Int = 1,
islast::Bool = false,
active_levels = ();
maxdepth = 5,
charset = YaoBlocks.BlockTreeCharSet(),
title = true,
compact = false,
)
print(io, node.name)
end

0 comments on commit d6dddbb

Please sign in to comment.