Skip to content

Commit f5d43e9

Browse files
committed
Add documentation for **kwargs for CircuitDrawerMatplotlib
1 parent f7f57a1 commit f5d43e9

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

projectq/backends/_circuits/_drawer_matplotlib.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,32 @@ def draw(self, qubit_labels=None, drawing_order=None):
192192
drawing_order (dict): position of each qubit in the output
193193
graphic. Keys: qubit IDs, Values: position of qubit on the
194194
qubit line in the graphic.
195+
**kwargs (dict): additional parameters are used to update
196+
the default plot parameters
195197
196198
Returns:
197199
A tuple containing the matplotlib figure and axes objects
200+
201+
Note:
202+
Additional keyword arguments can be passed to this
203+
function in order to further customize the figure output
204+
by matplotlib (default value in parentheses):
205+
206+
- fontsize (14): Font size in pt
207+
- column_spacing (.5): Vertical spacing between two
208+
neighbouring gates (roughly in inches)
209+
- control_radius (.015): Radius of the circle for controls
210+
- labels_margin (1): Margin between labels and begin of
211+
wire (roughly in inches)
212+
- linewidth (1): Width of line
213+
- not_radius (.03): Radius of the circle for X/NOT gates
214+
- gate_offset (.05): Inner margins for gates with a text
215+
representation
216+
- mgate_width (.1): Width of the measurement gate
217+
- swap_delta (.02): Half-size of the SWAP gate
218+
- x_offset (.05): Absolute X-offset for drawing within the axes
219+
- wire_height (1): Vertical spacing between two qubit
220+
wires (roughly in inches)
198221
"""
199222
max_depth = max(
200223
len(self._qubit_lines[qubit_id]) for qubit_id in self._qubit_lines)

projectq/backends/_circuits/_plot.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ def to_draw(qubit_lines, qubit_labels=None, drawing_order=None, **kwargs):
7878
Note:
7979
Numbering of qubit wires starts at 0 at the bottom and increases
8080
vertically.
81+
82+
Note:
83+
Additional keyword arguments can be passed to this
84+
function in order to further customize the figure output
85+
by matplotlib (default value in parentheses):
86+
87+
- fontsize (14): Font size in pt
88+
- column_spacing (.5): Vertical spacing between two
89+
neighbouring gates (roughly in inches)
90+
- control_radius (.015): Radius of the circle for controls
91+
- labels_margin (1): Margin between labels and begin of
92+
wire (roughly in inches)
93+
- linewidth (1): Width of line
94+
- not_radius (.03): Radius of the circle for X/NOT gates
95+
- gate_offset (.05): Inner margins for gates with a text
96+
representation
97+
- mgate_width (.1): Width of the measurement gate
98+
- swap_delta (.02): Half-size of the SWAP gate
99+
- x_offset (.05): Absolute X-offset for drawing within the axes
100+
- wire_height (1): Vertical spacing between two qubit
101+
wires (roughly in inches)
81102
"""
82103
if qubit_labels is None:
83104
qubit_labels = {qubit_id: r'$|0\rangle$' for qubit_id in qubit_lines}

0 commit comments

Comments
 (0)