You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Labels were added to text drawer in #4361, #4262, and #4420. Labels are user-supplied text that overwrites the names of gates and can be added to controls. This needs to be implemented for the mpl drawer. This issue is intended as a discussion to come to a consensus on design before we start coding.
The control labels can be placed on the highest control or below the lowest control if there are no controls above. And placed inside or outside the control line. In addition to what's shown here, some other possible questions would be,
If there are no params, should the original gate name be placed in the gate box underneath the gate label in smaller text? Might help prevent confusion if someone did YGate(label='X')
Or should the original gate name be placed in parens at the end of the label? This would work whether there are params or not and since most gate names are short would not take up too much space in most cases.
What do we do with gate labels for swap, cz, cu1, rzz, cx's and possibly others that don't have a box to display in? Should we use sidetext for these?
Currently all gate names are capitalized. Should all labels be capitalized or left as the user enters them?
One other thing. qc.cy(0, 1, label='Y Label') will always produce a control label. In the current implementation, the data structure is the same as qc.append(YGate().control(1, label='Y Label'), [0, 1]).
If you want a gate label, you have to use a YGate form.
The text was updated successfully, but these errors were encountered:
@1uciano@ajavadia Over the last several weeks (stuck in lockdown) I started going through the mpl drawer code and discovered there were a lot of redundancies, inefficiencies, and unused code. I decided to see how I might be able to restructure the code and also wanted to see if I could implement the text width calculations and gate and control labels.
After restructuring and adding the features, I now have a version that incorporates all the open issues, including text widths to determine gate and layer widths for a proportional font, and labels. Even with adding these features, the code is 140 lines shorter than the current master version.
I would like to do a PR, and I know you prefer incremental changes, but I feel like incremental changes will not produce an efficient, easily maintained mpl drawer in a reasonable time. I have tested the code extensively with many matplotlib backends and many circuits. Someone should probably still take some time to go through what I've done in some detail in order to approve it.
So should I submit a PR, which would list in detail all the changes I made, or would you prefer to stick with the current master and try to bring it up to a better standard over a longer period of time?
Thanks.
Below are images from the current master and from my revised version. isometry and initialize are not in the master image since these crash the drawer. Current master
What is the expected enhancement?
Labels were added to text drawer in #4361, #4262, and #4420. Labels are user-supplied text that overwrites the names of gates and can be added to controls. This needs to be implemented for the mpl drawer. This issue is intended as a discussion to come to a consensus on design before we start coding.
The control labels can be placed on the highest control or below the lowest control if there are no controls above. And placed inside or outside the control line. In addition to what's shown here, some other possible questions would be,
YGate(label='X')
One other thing.
qc.cy(0, 1, label='Y Label')
will always produce a control label. In the current implementation, the data structure is the same asqc.append(YGate().control(1, label='Y Label'), [0, 1])
.If you want a gate label, you have to use a YGate form.
The text was updated successfully, but these errors were encountered: