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

Skip to content

[WIP] DOC Updated documentation of arrow function to numpy docs format. #7029

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 6 commits into from
Sep 24, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
DOC Updated documentation of arrow function to numpy docs format.
  • Loading branch information
mobando committed Sep 22, 2016
commit 62bcf04b66da2dc15fcf4d63f09e8e0b95aaf6e1
43 changes: 31 additions & 12 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4522,13 +4522,35 @@ def arrow(self, x, y, dx, dy, **kwargs):
"""
Add an arrow to the axes.

Call signature::

arrow(x, y, dx, dy, **kwargs)

Draws arrow on specified axis from (*x*, *y*) to (*x* + *dx*,
*y* + *dy*). Uses FancyArrow patch to construct the arrow.

Draws arrow on specified axis from (`x`, `y`) to (`x` + `dx`,
`y` + `dy`). Uses FancyArrow patch to construct the arrow.

Parameters
----------
x : float
X-coordinate of the arrow base
y : float
Y-coordinate of the arrow base
dx : float
Length of arrow in x-coordinate
dy : float
Length of arrow in y-coordinate

Return
------
a : FancyArrow
patches.FancyArrow object

Other Parameters
-----------------
kwargs : `~matplotlib.patches.FancyArrow` properties.

See also
--------
%(FancyArrow)s : Parent object type.
Copy link
Member

Choose a reason for hiding this comment

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

It turns out this line messes the sphinx rendering. Do you replacing this line as:

     More valid arguments include:

     %(FancyArrow)s

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is correct. FancyArrow is interpolated into several other keyword arguments, and will need to be updated to interpolate correctly.

Copy link
Member

Choose a reason for hiding this comment

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

It is rendered properly.

Copy link
Member

Choose a reason for hiding this comment

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

(So there is no need to change anything in this PR)

Copy link
Member

Choose a reason for hiding this comment

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

FancyArrow is substituted with several keyword arguments documented in the old definition-list style, and then another list of keyword arguments ending with zorder. The trailing text here is then tacked onto the end (i.e., to zorder), which is not correct.

Copy link
Member

Choose a reason for hiding this comment

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

So what you mean is that ": Parent object type." should be removed?

Copy link
Member

Choose a reason for hiding this comment

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

That's only part of it. The FancyArrow part also needs to be updated to match the indentation here. For me, it causes a warning which stops the build (since warnings are errors by default), though it does still look reasonable if warnings are ignored.

Copy link
Member

Choose a reason for hiding this comment

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

Do not put anything after %(FancyArrow)s, that code get templated at import time to be a big tables.


Notes
-----
The resulting arrow is affected by the axes aspect ratio and limits.
This may produce an arrow whose head is not square with its stem. To
create an arrow whose head is square with its stem, use
Expand All @@ -4537,11 +4559,8 @@ def arrow(self, x, y, dx, dy, **kwargs):
ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
arrowprops=dict(arrowstyle="->"))

Optional kwargs control the arrow construction and properties:

%(FancyArrow)s

**Example:**
Examples
--------

.. plot:: mpl_examples/pylab_examples/arrow_demo.py
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 please add a blank line after this? I am not entirely sure why, but python3.5 is unhappy…

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I wasn't clear: I meant after the ".. plot::" directive.

"""
Expand Down