-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new feature wire_options to draw_mpl function (#6486)
**Context:** On the level of mid-scale algorithms, it might be nice to differentiate between different "types" of wires, for example by coloring them differently, or giving them distinct line styles. As an example, in PennyLaneAI/qml#1185 on preparing matrix product states, there are auxiliary bond qubits and physical qubits, and coloring them differently would be a neat thing to do. **Description of the Change:** Update the output wire_options that could change the line style and color for circuit output. ```python @qml.qnode(qml.device("default.qubit")) def node(x): for w in range(5): qml.Hadamard(w) return qml.expval(qml.PauliZ(0) @ qml.PauliY(1)) # Make all wires cyan and bold, # except for wires 2 and 6, which are dashed and another color wire_options = {"color": "cyan", "linewidth": 5, 2: {"linestyle": "--", "color": "red"}, 6: {"linestyle": "--", "color": "orange"} } _,ax = qml.draw_mpl(node, wire_options=wire_options)(0.52) ``` **Benefits:** When complicated sates and quantum circuits diagram are created, wires could be marked with different selections. **Possible Drawbacks:** N/A **Related GitHub Issues:** #6165 --------- Co-authored-by: David Wierichs <[email protected]> Co-authored-by: ringo-but-quantum <> Co-authored-by: Astral Cai <[email protected]> Co-authored-by: Christina Lee <[email protected]>
- Loading branch information
1 parent
34179a0
commit 73a617a
Showing
8 changed files
with
147 additions
and
19 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters