8000 Reduce space inside BoxOps and fix layering issues with boxes by enavarro51 · Pull Request #14529 · Qiskit/qiskit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Reduce space inside BoxOps and fix layering issues with boxes #14529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jun 4, 2025

Conversation

enavarro51
Copy link
Contributor
@enavarro51 enavarro51 commented Jun 3, 2025

Summary

Fixes #14506

Details and comments

This PR fixes an issue with BoxOps where there was an empty space on the left side of the box. Additionally this fixes an issue where other ops would not appear properly in layers that contained BoxOps. With this PR, a box containing noops disappears since it has a 0 width. If that's an issue, we can create a special case for empty boxes and widen the outside box and include an empty box inside.

qc = QuantumCircuit(5)
qc.x(0)
with qc.box():
    qc.x(0)

with qc.box():
    qc.x(0, label="xxxxii")
    qc.x(0, label="xxxxii")
qc.x(0)

with qc.box():
    qc.cx(2, 3)
    with qc.box():
        qc.noop(4)
qc.x(2)
qc.draw("mpl", scale=0.7, style={"showindex": True})

image

@enavarro51 enavarro51 requested a review from nonhermitian as a code owner June 3, 2025 21:37
@enavarro51 enavarro51 requested a review from a team as a code owner June 3, 2025 21:37
@qiskit-bot
Copy link
Collaborator

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

@coveralls
Copy link
coveralls commented Jun 3, 2025

Pull Request Test Coverage Report for Build 15430500343

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 1 file are covered.
  • 8 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.002%) to 87.891%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/visualization/circuit/matplotlib.py 0 6 0.0%
Files with Coverage Reduction New Missed Lines %
crates/transpiler/src/passes/unitary_synthesis.rs 1 94.57%
qiskit/visualization/circuit/matplotlib.py 1 48.79%
crates/circuit/src/symbol_expr.rs 3 75.25%
crates/qasm2/src/lex.rs 3 92.73%
Totals Coverage Status
Change from base Build 15428348544: -0.002%
Covered Lines: 81385
Relevant Lines: 92598

💛 - Coveralls

Copy link
Member
@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ed - this looks like a nice improvement!

@jakelishman jakelishman enabled auto-merge June 4, 2025 00:15
@jakelishman jakelishman added the mod: visualization qiskit.visualization label Jun 4, 2025
@jakelishman jakelishman added this pull request to the merge queue Jun 4, 2025
Merged via the queue into Qiskit:main with commit 545fe59 Jun 4, 2025
27 checks passed
@eliarbel eliarbel added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Jun 5, 2025
@jakelishman jakelishman added this to the 2.1.0 milestone Jun 5, 2025
rahaman-quantum pushed a commit to rahaman-quantum/qiskit that referenced this pull request Jun 20, 2025
…#14529)

* Fix typing-extensions

* Reduce box sizing

* Fix layering of BoxOps with other ops

* Lint and comments

* Update ref image

* Add release note

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
7F96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: visualization qiskit.visualization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce leading space inside drawn BoxOp
5 participants
0