-
Notifications
You must be signed in to change notification settings - Fork 603
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
Improvements to matplotlib drawing style and functionality #1931
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #1931 +/- ##
=======================================
Coverage 98.81% 98.81%
=======================================
Files 225 225
Lines 17175 17187 +12
=======================================
+ Hits 16971 16983 +12
Misses 204 204
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes @albi3ro, should I check that every png image corresponds to actual circuit?
|
||
@fontsize.setter | ||
def fontsize(self, value): | ||
self._fontsize = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a small docstring here.
@@ -562,11 +578,13 @@ def _ctrlo_circ(self, layer, wires, options=None): | |||
|
|||
self._ax.add_patch(circ_ctrlo) | |||
|
|||
def CNOT(self, layer, wires, options=None): | |||
def CNOT(self, layer, wires, control_values=None, options=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition 👍
pennylane/transforms/draw.py
Outdated
@@ -162,6 +162,7 @@ def draw_mpl(qnode, wire_order=None, show_all_wires=False, decimals=None, **kwar | |||
show_all_wires (bool): If True, all wires, including empty wires, are printed. | |||
decimals (int): How many decimal points to include when formatting operation parameters. | |||
Default ``None`` will omit parameters from operation labels. | |||
fontsize (float or str): fontsize for text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give example of what string we can pass as argument?
@rmoyard I've double-checked the documentation looks fine, and as long as they look good there, the images are good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @albi3ro it looks good to me 💯
This minor PR accomplishes:
fontsize
a documented public attributetape_mpl
anddraw_mpl
acceptfontsize
as a keyword argumentcontrol_values
keyword to theCNOT
method. This will allow easy support for arbitraryMultiControlledX
gates.plt.rcParams['lines.color']
mpl.patches.FancyBboxPatch
forplt.Rectangle
. It looks better.This PR will not add active wire notches. That will take enough design work that it will occupy it's own PR.