-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FancyArrowPatch docstring overhaul #8319
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
Conversation
Docstring overhaul Small fixes
lib/matplotlib/patches.py
Outdated
%(AvailableConnectorstyles)s | ||
Parameters | ||
---------- | ||
posA, posB: None, tuple, optional (default: 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.
Can you add a space before the column? Numpydoc doesn't format properly elsewise.
lib/matplotlib/patches.py
Outdated
Parameters | ||
---------- | ||
posA, posB: None, tuple, optional (default: None) | ||
(x,y) co-ordinates of arrow tail and arrow head respectively. |
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.
I think it should be "coordinates".
lib/matplotlib/patches.py
Outdated
|
||
%(AvailableArrowstyles)s | ||
%(AvailableArrowstyles)s |
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.
We are working towards removing docstring interpolation. If the available arrowstyles are documented else where, can you replace this with the location of the documentation instead of the interpolation? If it isn't documented elsewhere, we can focus on this later.
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.
I'm not too sure how to do this - do you know of another PR or commit that has done this replacement?
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.
@@ -3990,10 +3990,10 @@ def __str__(self): | |||
if self._posA_posB is not None: | |||
(x1, y1), (x2, y2) = self._posA_posB | |||
return self.__class__.__name__ \ | |||
+ "(%g,%g->%g,%g)" % (x1, y1, x2, y2) |
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.
"{}({:g},{:g}->{:g},{:g})".format(type(self).__name__, x1, y1, x2, y2)
(or similar with %
formatting)
likewise below
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.
I'd rather not touch the actual code in this PR if that's okay?
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.
sure
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.
LGTM 👍
lib/matplotlib/patches.py
Outdated
**kwargs): | ||
""" | ||
If *posA* and *posB* is given, a path connecting two point are | ||
created according to the connectionstyle. The path will be | ||
If *posA* and *posB* are given, a path connecting two points are |
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.
... the two points is created.
lib/matplotlib/patches.py
Outdated
shrinkA, shrinkB: scalar, optional (default: 2) | ||
|
||
mutation_scale: scalar, optional (default: 1) | ||
Value with which attributes of arrowstyle (e.g., head_length) |
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.
Add some more *
here and below?
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.
noooooooooooooooooo :(
lib/matplotlib/patches.py
Outdated
@@ -4075,28 +4106,40 @@ def __init__(self, posA=None, posB=None, | |||
self._mutation_aspect = mutation_aspect | |||
|
|||
self.set_dpi_cor(dpi_cor) | |||
#self._draw_in_display_coordinate = True | |||
# self._draw_in_display_coordinate = True |
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.
are there other mentions of this attribute in the codebase? if it's just a relic of old code it should just be removed.
lib/matplotlib/patches.py
Outdated
|
||
Parameters | ||
---------- | ||
connectionstyle: None, ConnectionStyle instance, or string |
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.
None, ConnectionStyle, or str
?
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 also add a space after the column? It won't render properly elsewise.
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.
@NelleV I'm confused as to what you mean, my local build seems to look fine.
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.
It should be connectionstyle : None, ConnectionStyle instance, or string
lib/matplotlib/patches.py
Outdated
""" | ||
return self._connector | ||
|
||
def set_arrowstyle(self, arrowstyle=None, **kw): | ||
""" | ||
Set the arrow style. | ||
Set the arrow style. Old attributes are forgotten. Without arguments | ||
(or with `arrowstyle=None`) returns available box styles as a list of |
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.
double backticks
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.
There are spaces missing before columns in the arguments list. Without a space, this will not render properly.
*mutation_aspect* : The height of the rectangle will be | ||
squeezed by this value before the mutation and the mutated | ||
box will be stretched by the inverse of it. default=None. | ||
arrow_transmuter : |
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.
This does not appear to be used; maybe it should not be documented? Or marked deprecated or something.
|
||
connector : |
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.
Also seems to be unused. Actually, both of these are used in Connector
, which subclasses from FancyArrowPatch
, so I think maybe someone added it here to give it the same API. Maybe just mark these two as ignored.
Head and tail patch respectively. :class:`matplotlib.patch.Patch` | ||
instance. | ||
|
||
shrinkA, shrinkB : scalar, optional (default: 2) |
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.
"Shrinking factor of tail and head of arrow"?
lib/matplotlib/patches.py
Outdated
---------- | ||
connectionstyle : None, ConnectionStyle instance, or string | ||
Can be a string with connectionstyle name with | ||
optional comma-separated attributes, eg:: |
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.
e.g.
lib/matplotlib/patches.py
Outdated
|
||
set_connectionstyle("arc,angleA=0,armA=30,rad=10") | ||
set_connectionstyle("arc", angleA=0,armA=30,rad=10) | ||
Alternatively, the attributes can be provided as keywords, eg:: |
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.
e.g.
lib/matplotlib/patches.py
Outdated
---------- | ||
arrowstyle : None, ArrowStyle, str, optional (default: None) | ||
Can be a string with arrowstyle name with optional comma-separated | ||
attributes, eg.:: |
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.
e.g.
lib/matplotlib/patches.py
Outdated
|
||
Old attrs simply are forgotten. | ||
Alternatively attributes can be provided as keywords, eg.:: |
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.
e.g.
lib/matplotlib/patches.py
Outdated
""" | ||
self._mutation_scale = scale | ||
self.stale = True | ||
|
||
def get_mutation_scale(self): | ||
""" | ||
Return the mutation scale. | ||
|
||
Returns | ||
---------- |
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.
Extra dashes.
still waiting for fixing @QuLogic's comments, but mine are fixed.
They've been handled below the lines I commented on; GitHub is not hiding the diff though. |
Ah, I see. |
An overhaul of the FancyArrowPatch docstring. There's a couple of kwargs I'm not too sure about so I've left them blank; suggestions welcome.