So, I am fairly new to Qiskit, and I've been following Qiskit textbook recently. In the chapter 7, where the QC lab exercises are located, in the first lab when working on the real hardware it is required to select the optimal initial_layout setting during the transpile function call based on the error map consideration. Now, I understand that the initial layout governs how computational qubits map onto the physical qubits. For instance, if we select hardware option with 5 qubits (e.g. ibmq_quito) and we designe a circuit with e.g. 4 qubits, with initial_layout we can specify any 4-element combination out of 5 possible elements. However, what I fail to understand is what exactly is the error map specified in the lab exercise. Does it mean to sweep all possible qubit configurations (c1 = [0, 1, 2, 3], c2 = [0, 1, 2, 4], c3 = [1, 2, 3, 4], ...) and pick the one with lowest noise impact, or a different approach must be taken?

I would appreciate any input on this.


2 Answers 2


One of the pre-coded cells in the lab has the command backend. If you execute the cell with the command backend after running the command import qiskit.tools.jupyter, the widget will be opened for the backend.

The widget shows the chosen backend information graphically and one of the tabs is called error map showing the qubit connectivity with all kinds of error information coded in color. You can find same information here for ibmq_quito for example. The question is asking to find a good initial layout considering connectivity and error information that you can find from the map. Hope that it helps.

  • $\begingroup$ a small question here: Are you aware if there is another way of calling the error map, like some special plot function (like plot_histogram(), or QuantumCircuit.draw())? Because this way (IBMQ.load_account().get_backend('ibmq_lima') after import qiskit.tools.jupyter) seems somewhat indirect, like it is a side-effect. $\endgroup$
    – Akhaim
    Sep 14, 2021 at 18:46
  • $\begingroup$ Actually there is! @Željko_JL Here is the example code. from qiskit.test.mock import FakeGuadalupe from qiskit.visualization import plot_error_map backend = FakeGuadalupe() plot_error_map(backend) $\endgroup$ Sep 17, 2021 at 16:26

As an alternative to what @HwajungKang suggested in their answer, a somewhat more direct approach can be used for plotting the error_map via the plot_error_map located inside the qiskit.visualization module. So, for instance:

from qiskit.visualization import plot_error_map
from qiskit import IBMQ

# Load IBMQ account:

# Select IBMQ provider:
provider = IBMQ.get_provider('ibm-q')

# Get specific user selected real hardware backend object:
backend = provider.get_backend('ibmq_lima')

# Plot the error map of the real hardware backend object:

will do the explicit plotting of the error_map for the ibmq_lima backend, i.e.: enter image description here

From there, one can observe the error distribution between the qubits and may pick ones that should result in the least error.

  • $\begingroup$ oh you already got it! great! $\endgroup$ Sep 17, 2021 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.