Skip to content

Fix barrier label trunctation in matplotlib circuit renders#15973

Merged
jakelishman merged 4 commits intoQiskit:mainfrom
ihincks:fix-mpl-max-label-ln
Apr 9, 2026
Merged

Fix barrier label trunctation in matplotlib circuit renders#15973
jakelishman merged 4 commits intoQiskit:mainfrom
ihincks:fix-mpl-max-label-ln

Conversation

@ihincks
Copy link
Copy Markdown
Contributor

@ihincks ihincks commented Apr 8, 2026

Summary

This PR fixes two issues to do with the drawing of labelled barriers in the matplotlib circuit renderer:

  1. Add barrier_label_len option to circuit drawers #15776 did not correctly pass the new option's value down to the matplotlib renderer, meaning you always end up with the default value of 16. The test didn't catch it because it used a barrier label length bigger than the default.
  2. Add barrier_label_len option to circuit drawers #15776 failed to realize that the width of the layer also needs a fix. Currently, it's using the length of the untruncated label to determine the width, which kind of defeats the purpose.

Details and comments

No reno because the bug isn't released.

@ihincks ihincks requested a review from a team as a code owner April 8, 2026 23:48
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

@ihincks ihincks changed the title Fix barrier label trunctation Fix barrier label trunctation in matplotlib circuit renders Apr 8, 2026
@ihincks ihincks added the mod: visualization qiskit.visualization label Apr 8, 2026
@jakelishman jakelishman added this to the 2.4.0 milestone Apr 9, 2026
@github-project-automation github-project-automation Bot moved this to Ready in Qiskit 2.4 Apr 9, 2026
@jakelishman jakelishman added the stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge. label Apr 9, 2026
@jakelishman jakelishman added this pull request to the merge queue Apr 9, 2026
Merged via the queue into Qiskit:main with commit 2fb5be6 Apr 9, 2026
27 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in Qiskit 2.4 Apr 9, 2026
mergify Bot pushed a commit that referenced this pull request Apr 9, 2026
* Fix mpl barrier_label_len with non-default value

* update test

* fix the whitespace issue too

* update test image

(cherry picked from commit 2fb5be6)
github-merge-queue Bot pushed a commit that referenced this pull request Apr 9, 2026
…15978)

* Fix mpl barrier_label_len with non-default value

* update test

* fix the whitespace issue too

* update test image

(cherry picked from commit 2fb5be6)

Co-authored-by: Ian Hincks <ian.hincks@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod: visualization qiskit.visualization stable backport potential Make Mergify open a backport PR to the most recent stable branch on merge.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants