Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update documentation guide#9805

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 1 commit intomatplotlib:masterfromdstansby:doc-guide
Nov 28, 2017
Merged

Conversation

dstansby
Copy link
Member

@dstansbydstansby commentedNov 16, 2017
edited
Loading

Needs a bit more work, but the aim is tofix#9786 eventually and generally clean the writing documentation guide. Comments very welcome and encouraged! (please also add to the TODO list below)

TODO:

  • Link to numpydoc docs
  • Add section on intersphinx

jklymak reacted with thumbs up emoji

.. rubric:: Footnotes

.. [#] For example.

* Use the *note* and *warning* directives, sparingly, to draw attention to
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This delted block is covered by numpydoc guidelines


The function `matplotlib.artist.kwdoc` and the decorator
`matplotlib.docstring.dedent_interpd` facilitate this. They combinepython
`matplotlib.docstring.dedent_interpd` facilitate this. They combinePython
Copy link
Member

@jklymakjklymakNov 17, 2017
edited
Loading

Choose a reason for hiding this comment

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

Given the big squak some raised when I tried to use this facilty, should this be in the doc guide?

Copy link
Member

Choose a reason for hiding this comment

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

I'll still re-iterate that I was told explcitlynot to do this for the legend docs a month ago. So if we are not allowed to use this functionality it should be noted here.

@@ -91,244 +90,131 @@ statement, such as::

.. include:: ../../TODO

docstrings
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This whole section has moved down to the bottom

directories. To exclude the example from having an image rendered,
insert the following special comment anywhere in the script:
automatically included in the HTML docs. To exclude the example from having an
image rendered, insert the following special comment anywhere in the script:
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Is this still true@choldgraf ?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah no, instead they should putsgskip somewhere in the filename. Maybe worth just noting "all files in theexamples directory will be automatically run and rendered into documentation with sphinx-gallery (incl. link)" and leave it at that?

dstansby reacted with thumbs up emoji

Please do not describe ``argument`` like this.

* Mathematical expressions can be rendered as png images in html, and in the
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I've removed the maths, ipython, and footnotes bits, as they are covered in Sphinx documentation, and I don't think they're common enough to need a specific section in the Matplotlib docs.

The documentation sources are found in the :file:`doc/` directory in
the trunk. To build the users guide in html format, cd into
:file:`doc/` and do:
The documentation sources are found in the :file:`doc/` directory in the trunk.
Copy link
Contributor

Choose a reason for hiding this comment

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

def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
label='', **kwargs):
"""
Plot horizontal lines at each `y` from `xmin` to `xmax`.
Copy link
Contributor

Choose a reason for hiding this comment

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

should be asterisks :p

dstansby reacted with thumbs up emoji
* Use the *seealso* directive, for example:
Other Parameters
----------------
**kwargs : `~matplotlib.collections.LineCollection` properties.
Copy link
Contributor

Choose a reason for hiding this comment

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

one space too many after the colon

dstansby reacted with thumbs up emoji

* Please keep the :ref:`glossary` in mind when writing documentation. You can
create a references to a term in the glossary with the ``:term:`` role.
Please do not describe `argument` like this.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a (short) explanation similar to the one I gave at#9786 (comment) (about the meaning of single backticks) may be helpful.

it via a relative path from the document where the rst file resides, e.g., in
:file:`users/navigation_toolbar.rst`, we refer to the image icons with::
In the documentation, you may want to include to a document in the
Matplotlib src, e.g., a license file or an image file from `mpl-data`,
Copy link
Contributor

Choose a reason for hiding this comment

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

sources

dstansby reacted with thumbs up emoji
mpl-data directory, I use the symlink directory. For example, from
:file:`customizing.rst`::
In the `users` subdirectory, if you want to refer to a file in the mpl-data
directory, you can use the symlink directory. For example, from
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there's a symlink anymore?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

In master it looks like there still is

@@ -454,7 +287,7 @@ files are duplicated and large)
Internal section references
===========================

To maximize internal consistency in sectionlabeling and references,
To maximize internal consistency in sectionlabelling and references,
Copy link
Contributor

Choose a reason for hiding this comment

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

US english one ell? :)

dstansby reacted with thumbs up emoji
@@ -467,8 +300,8 @@ and refer to it using the standard reference syntax:

See :ref:`howto-webapp`

Keep in mind that we may want to reorganize the contents later, so
let's avoid top level names in references like ``user`` or ``devel``
Keep in mind that we may want to re-organize the contents later, so
Copy link
Contributor

Choose a reason for hiding this comment

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

dstansby reacted with thumbs up emoji
autoscaled; default True. See Axes.autoscale_view for more
information
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

the pass is unneeded (syntax is correct without it and it's not the real impl either)

The kwargs are Line2D properties:
%(Line2D)s

kwargs scalex and scaley, if defined, are passed on
Copy link
Contributor

Choose a reason for hiding this comment

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

should use correct markup (asterisks, backquotes below)

Developer's tips for documenting Matplotlib
===========================================
================================
Developer's tips for documenting
Copy link
Contributor

Choose a reason for hiding this comment

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

"Documentation guidelines"?

the Sphinx_ documentation generation tool. There are several extra
requirements that are needed to build the documentation. They are listed in
:file:`doc-requirements.txt` as well as listed below:
the Sphinx_ documentation generation tool. There are several extra requirements
Copy link
Contributor

Choose a reason for hiding this comment

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

also edited in the Makefile PR

@choldgraf
Copy link
Contributor

@dstansby thanks for cleaning this up! +1 on merge after@anntzer 's comments addressed. feel free to ping me after you do so

generated directories :file:`docs/gallery` and :file:`docs/tutorials` can be
safely deleted.
the directories :file:`docs/gallery` and :file:`docs/tutorials`
are generated.
Copy link
Member

@jklymakjklymakNov 21, 2017
edited
Loading

Choose a reason for hiding this comment

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

I'd say something like: "...are automatically generated. Do not edit the rst files in :file:docs/gallery and :file:docs/tutorials, as they are rebuilt from the sources in the root directory"

I was mystified for a while when my changes to files in these directories were being overwritten ;-)

Matplotlib makes extensive use of keyword arguments as pass-through
arguments, there are a many cases where a table is used in place of a
definition list for autogenerated sections of docstrings.
Please do not describe ``argument`` like this.

Figures
=======

Copy link
Member

Choose a reason for hiding this comment

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

This could use an intoroductory paragraph, or even a change of heading. I find it very mysterious what figures you are talking about. In docstrings? I think you mean in examples and tutorials. If so, maybe a "Writing an example or tutorial" would be a more useful heading, and figure creation is of course the most important thing that happens in that context.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Added a bit more text and changed the title; is it better now?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think maybe a specific section on writing an example/tutorial is needed.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Maybe a new document? This one is quite long already, so sticking to just "Documenting code" is better, and a separate "Writing examples and tutorials" guide can be written.


Plot directive documentation
''''''''''''''''''''''''''''

.. automodule:: matplotlib.sphinxext.plot_directive
:no-undoc-members:

Examples
Copy link
Member

Choose a reason for hiding this comment

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

As above. This seems the heading (+ Tutorials) not "Figures" per se. (I guess there are figures in the numpydocs?)

@@ -492,11 +308,91 @@ For everything but top level chapters, please use ``Upper lower`` for
section titles, e.g., ``Possible hangups`` rather than ``Possible
Hangups``

Setters, getters, and keyword arguments
=======================================
Copy link
Member

Choose a reason for hiding this comment

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

Why is this way down here instead of up w/ the numpydoc section?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Moved back up

@dstansby
Copy link
MemberAuthor

dstansby commentedNov 22, 2017
edited
Loading

Okay, I think I'm ready for reviews! (ping@choldgraf)

@dstansbydstansby changed the titleWIP Update documentating guideUpdate documentating guideNov 22, 2017
Add link to numpydocAdd missing dashFix buildGet rid of extra bitsMove setter/getter/kwarg section to near bottomMore cleanupRemove sections covered in sphinx docsMore small fixesCorrect sgskipUpdate titleMore cleaningMove setters/getters/kwargs backClarify examples/tutorials directoriesFix code indentationImprove figure discussionImprove some headingsAdd intersphinx section
@dstansbydstansby changed the titleUpdate documentating guideUpdate documentation guideNov 22, 2017
@jklymak
Copy link
Member


`~matplotlib.collections.LineCollection`

It is also possible to add links to code in Python, Numpy, Scipy, or Pandas.
Copy link
Member

Choose a reason for hiding this comment

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

for example:

.. code-block:: python

numpy.mean

argument the method accepts. e.g., in `.Line2D`:
the `~.matplotlib.artist.Artist` class. The setter methods use the docstring
with the ACCEPTS token to indicate the type of argument the method accepts.
e.g., in `.Line2D`:
Copy link
Member

Choose a reason for hiding this comment

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

OK, I've written some docs, and have used matplotlib for a while. I don't know what the first sentence of this section means. Can we clarify for the somewhat uninitiated?

Copy link
Contributor

Choose a reason for hiding this comment

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

Something like

Artist properties are implemented using setter and getter methods (because Matplotlib predates the introductions of theproperty decorator in Python). By convention, these setters and getters are namedset_PROPERTYNAME andget_PROPERTYNAME; the list of properties thusly defined on an artist and their values can be listed by the~.pyplot.setp and~.pyplot.getp functions.

Property setter methods should indicate the values they accept using a (legacy) special block in the docstring, starting withACCEPTS, as follows: (code example follows)

The ACCEPTS block is used to render a table of all properties and their acceptable values in the docs; it can also be displayed using, e.g.,plt.setp(Line2D) (all properties) orplt.setp(Line2D, 'linestyle') (just one property).

looks good?

Copy link
Member

Choose a reason for hiding this comment

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

Yes that makes sense to me. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

@dstansby can you apply the patch? or I can do it too

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Feel free to push any changes to this section - I don't have the bandwidth to get my head around it at the moment!

Here is a description of *argument*

Please do not use the ```default role```:
Adding figures
Copy link
Member

Choose a reason for hiding this comment

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

I like the text below. I'm still not sure about the heading....

@jklymak
Copy link
Member

General comment: I still think this could use a bit more basic guidance on the different types of documentation at the top. i.e.:

  • ReST files in docs/users and docs/faqs and ?? are translated to html and other downstream formats during the build process.
  • API documentation from docstrings is automatically extracted from the python sources in/lib/matplotlib
  • docs/examples anddocs/tutorials are automatically generated from running the python scripts in/examples and/tutorials. Don't edit the generated files!
dstansby reacted with thumbs up emoji

@tacaswelltacaswell added this to thev2.1.0-doc milestoneNov 23, 2017
@choldgraf
Copy link
Contributor

My 2 cents: I think this should be merged. Even if it is not perfect it is a definite improvement in the documentation, and we've already iterated on this quite a lot. People can always open less ambitious PRs to spot-check things but@dstansby has already done a lot on this PR. Obviously it's their call if they want to keep iterating on comments etc, but let's not let perfect become the enemy of good.

@efiring
Copy link
Member

I'm tempted to follow@choldgraf's advice and merge this, but it looks like@anntzer and/or@jklymak might want to push some quick changes first. Do you?

@jklymak
Copy link
Member

jklymak commentedNov 28, 2017
edited
Loading

I think its easier for me to work from master, so I'm happy to put a PR in after this improvement! 👍

@anntzer
Copy link
Contributor

actually a bit busy today, can anyone prepare a PR from my patch?

@jklymak
Copy link
Member

Yes, I'll definitely incude your patch. Its very helpful...

@efiringefiring merged commit2f897dc intomatplotlib:masterNov 28, 2017
@lumberbot-app
Copy link

There seem to be a conflict, please backport manually

@dstansby
Copy link
MemberAuthor

Thanks for merging! I was happy to add more changes, but didn't/don't have the time to around now anyway.

@dstansbydstansby deleted the doc-guide branchNovember 28, 2017 19:35
dstansby pushed a commit to dstansby/matplotlib that referenced this pull requestNov 28, 2017
dstansby added a commit that referenced this pull requestNov 29, 2017
@tacaswell
Copy link
Member

Back port taken care of my55830e5 merge of v2.1.0-doc in to 2.1.x

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer left review comments

@choldgrafcholdgrafcholdgraf left review comments

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v2.1.0-doc
Development

Successfully merging this pull request may close these issues.

Consistent Documentation Guide for Docstrings
6 participants
@dstansby@choldgraf@jklymak@efiring@anntzer@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp