diff --git a/qiskit/visualization/gate_map.py b/qiskit/visualization/gate_map.py index d8ffb6e10388..e353ee98c309 100644 --- a/qiskit/visualization/gate_map.py +++ b/qiskit/visualization/gate_map.py @@ -1039,7 +1039,9 @@ def plot_coupling_map( graph = CouplingMap(coupling_map).graph if not plot_directed: + line_color_map = dict(zip(graph.edge_list(), line_color)) graph = graph.to_undirected(multigraph=False) + line_color = [line_color_map[edge] for edge in graph.edge_list()] for node in graph.node_indices(): graph[node] = node diff --git a/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml b/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml new file mode 100644 index 000000000000..72f2c95962a5 --- /dev/null +++ b/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed a bug in :func:`plot_coupling_map` that caused the edges of the coupling map to be colored incorrectly. + See https://github.com/Qiskit/qiskit/pull/12369 for details.