Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 5 commits into from
Apr 12, 2017
Merged

Conversation

dstansby
Copy link
Member

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.

Docstring overhaul

Small fixes
%(AvailableConnectorstyles)s
Parameters
----------
posA, posB: None, tuple, optional (default: None)
Copy link
Member

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.

Parameters
----------
posA, posB: None, tuple, optional (default: None)
(x,y) co-ordinates of arrow tail and arrow head respectively.
Copy link
Member

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".


%(AvailableArrowstyles)s
%(AvailableArrowstyles)s
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

I may be wrong but I think @NelleV is referring to this kind of stuff. Unfortunately, I am not sure that the arrow styles are document elsewhere than in mpatches.ArrowStyle._style_list , which has much less information than _pprint_styles(ArrowStyle._style_list).

@@ -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)
Copy link
Contributor

@anntzer anntzer Mar 18, 2017

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

Copy link
Member Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

sure

Copy link
Member

@NelleV NelleV left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@NelleV NelleV changed the title FancyArrowPatch docstring overhaul [MRG+1] FancyArrowPatch docstring overhaul Mar 19, 2017
**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
Copy link
Contributor

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.

shrinkA, shrinkB: scalar, optional (default: 2)

mutation_scale: scalar, optional (default: 1)
Value with which attributes of arrowstyle (e.g., head_length)
Copy link
Contributor

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?

Copy link
Member

Choose a reason for hiding this comment

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

noooooooooooooooooo :(

@@ -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
Copy link
Contributor

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.


Parameters
----------
connectionstyle: None, ConnectionStyle instance, or string
Copy link
Contributor

Choose a reason for hiding this comment

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

None, ConnectionStyle, or str?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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

"""
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
Copy link
Contributor

Choose a reason for hiding this comment

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

double backticks

NelleV
NelleV previously requested changes Mar 20, 2017
Copy link
Member

@NelleV NelleV left a 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 :
Copy link
Member

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 :
Copy link
Member

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)
Copy link
Member

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"?

----------
connectionstyle : None, ConnectionStyle instance, or string
Can be a string with connectionstyle name with
optional comma-separated attributes, eg::
Copy link
Member

Choose a reason for hiding this comment

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

e.g.


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::
Copy link
Member

Choose a reason for hiding this comment

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

e.g.

----------
arrowstyle : None, ArrowStyle, str, optional (default: None)
Can be a string with arrowstyle name with optional comma-separated
attributes, eg.::
Copy link
Member

Choose a reason for hiding this comment

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

e.g.


Old attrs simply are forgotten.
Alternatively attributes can be provided as keywords, eg.::
Copy link
Member

Choose a reason for hiding this comment

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

e.g.

"""
self._mutation_scale = scale
self.stale = True

def get_mutation_scale(self):
"""
Return the mutation scale.

Returns
----------
Copy link
Member

Choose a reason for hiding this comment

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

Extra dashes.

@QuLogic QuLogic changed the title [MRG+1] FancyArrowPatch docstring overhaul FancyArrowPatch docstring overhaul Mar 26, 2017
@NelleV NelleV dismissed their stale review March 26, 2017 22:38

Changes have been applied.

anntzer
anntzer previously approved these changes Apr 5, 2017
@anntzer anntzer dismissed their stale review April 5, 2017 20:58

still waiting for fixing @QuLogic's comments, but mine are fixed.

@anntzer
Copy link
Contributor

anntzer commented Apr 12, 2017

@dstansby did react to @QuLogic's comments so let's assume until further notice that he plans to address the issues.

@QuLogic
Copy link
Member

QuLogic commented Apr 12, 2017

They've been handled below the lines I commented on; GitHub is not hiding the diff though.

@anntzer
Copy link
Contributor

anntzer commented Apr 12, 2017

Ah, I see.

@anntzer anntzer merged commit c5c5a5d into matplotlib:master Apr 12, 2017
@dstansby dstansby deleted the fancyarrow-doc branch April 12, 2017 09:25
@QuLogic QuLogic added this to the v2.1 milestone Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants