Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions projectq/backends/_circuits/_drawer_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def receive(self, command_list):
if not self.is_last_engine:
self.send([cmd])

def draw(self, qubit_labels=None, drawing_order=None):
def draw(self, qubit_labels=None, drawing_order=None, **kwargs):
"""
Generates and returns the plot of the quantum circuit stored so far

Expand Down Expand Up @@ -228,4 +228,5 @@ def draw(self, qubit_labels=None, drawing_order=None):

return to_draw(self._qubit_lines,
qubit_labels=qubit_labels,
drawing_order=drawing_order)
drawing_order=drawing_order,
**kwargs)
14 changes: 8 additions & 6 deletions projectq/backends/_circuits/_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,14 @@ def calculate_gate_grid(axes, qubit_lines, plot_params):
]

gate_grid = np.array([0] * (depth + 1), dtype=float)

gate_grid[0] = plot_params['labels_margin'] + (width_list[0]) * 0.5
for idx in range(1, depth):
gate_grid[idx] = gate_grid[idx - 1] + column_spacing + (
width_list[idx] + width_list[idx - 1]) * 0.5
gate_grid[-1] = gate_grid[-2] + column_spacing + width_list[-1] * 0.5

gate_grid[0] = plot_params['labels_margin']
if depth > 0:
gate_grid[0] += width_list[0] * 0.5
for idx in range(1, depth):
gate_grid[idx] = gate_grid[idx - 1] + column_spacing + (
width_list[idx] + width_list[idx - 1]) * 0.5
gate_grid[-1] = gate_grid[-2] + column_spacing + width_list[-1] * 0.5
return gate_grid


Expand Down