qiskit: plot_circuit_layout output unexpected with registerless circuits

What is the current behavior?

Consider the following backend:

from qiskit.visualization import plot_gate_map
from qiskit.test.mock import FakeManhattan

backend = FakeManhattan()
plot_gate_map(backend)

image

Let’s create a circuit with a layout:

from qiskit import QuantumCircuit
from qiskit.visualization import plot_circuit_layout
from qiskit.transpiler import Layout

circuit = QuantumCircuit(15)
circuit._layout = Layout({ circuit.qubits[im_j]: cm_i for cm_i, im_j in [ (i,j) for i,j in enumerate(range(14, -1, -1)) ]})
plot_circuit_layout(circuit, backend)

image

The drawing is unexpected to me. The layout is non-trivial, for example:

circuit._layout[0]
Qubit(QuantumRegister(15, 'q'), 14)

What is the expected behavior?

I would expect 14 in the top corner, where the 0 appears.

Suggested solutions

This bug is probably related with the recently introduced registerless circuits.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

sure thing @lmpawan10 I’ll assign to you 😄

As it is your first time here please remember to read the contributing guide. You may also find this youtube series useful for github tips as well