FancyArrowPatch docstring overhaul#8319
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.
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.
I think it should be "coordinates".
| available: | ||
|
|
||
| %(AvailableArrowstyles)s | ||
| %(AvailableArrowstyles)s |
There was a problem hiding this comment.
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.
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.
| 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.
"{}({: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.
I'd rather not touch the actual code in this PR if that's okay?
lib/matplotlib/patches.py
Outdated
| """ | ||
| 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.
... 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.
Add some more * here and below?
lib/matplotlib/patches.py
Outdated
|
|
||
| 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.
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.
None, ConnectionStyle, or str?
There was a problem hiding this comment.
Can you also add a space after the column? It won't render properly elsewise.
There was a problem hiding this comment.
@NelleV I'm confused as to what you mean, my local build seems to look fine.
There was a problem hiding this comment.
It should be connectionstyle : None, ConnectionStyle instance, or string
lib/matplotlib/patches.py
Outdated
| """ | ||
| 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 |
NelleV
left a comment
There was a problem hiding this comment.
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.
This does not appear to be used; maybe it should not be documented? Or marked deprecated or something.
|
|
||
| %(AvailableConnectorstyles)s | ||
|
|
||
| connector : |
There was a problem hiding this comment.
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.
"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:: |
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:: |
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.:: |
lib/matplotlib/patches.py
Outdated
| set_arrowstyle("Fancy,head_length=0.2") | ||
|
|
||
| Old attrs simply are forgotten. | ||
| Alternatively attributes can be provided as keywords, eg.:: |
lib/matplotlib/patches.py
Outdated
| Return the mutation scale. | ||
|
|
||
| Returns | ||
| ---------- |
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.