Skip to content

Review documentation of Axes plotting methods #10148

Closed

Description

@timhoffm

As a follow up of #7205, some docstrings of the basic Axes plotting methods could need a bit care. In particular:

  • Conversion to numpydoc format.
  • Improvements on the descriptions.

I intend to go through the methods and update their docs. This is a summary issue to keep track of my progress:

Basic

  • Axes.plot
  • Axes.errorbar
  • Axes.scatter
  • Axes.plot_date
  • Axes.step
  • Axes.loglog
  • Axes.semilogx
  • Axes.semilogy
  • Axes.fill_between
  • Axes.fill_betweenx
  • Axes.bar
  • Axes.barh
  • Axes.stem
  • Axes.eventplot
  • Axes.pie
  • Axes.stackplot
  • Axes.broken_barh
  • Axes.vlines
  • Axes.hlines
  • Axes.fill

Spans

  • Axes.axhline
  • Axes.axhspan
  • Axes.axvline
  • Axes.axvspan

Spectral

  • Axes.acorr
  • Axes.angle_spectrum
  • Axes.cohere
  • Axes.csd
  • Axes.magnitude_spectrum
  • Axes.phase_spectrum
  • Axes.psd
  • Axes.specgram
  • Axes.xcorr

Statistics

  • Axes.boxplot
  • Axes.violinplot
  • Axes.violin
  • Axes.bxp

Binned

  • Axes.hexbin
  • Axes.hist
  • Axes.hist2d

Contours

  • Axes.clabel
  • Axes.contour
  • Axes.contourf

Array

  • Axes.imshow
  • Axes.matshow
  • Axes.pcolor
  • Axes.pcolorfast
  • Axes.pcolormesh
  • Axes.spy

Unstructured triangles

  • Axes.tripcolor
  • Axes.triplot
  • Axes.tricontour
  • Axes.tricontourf

Text and Annotations

  • Axes.annotate
  • Axes.text
  • Axes.table
  • Axes.arrow

Fields

  • Axes.barbs
  • Axes.quiver
  • Axes.quiverkey
  • Axes.streamplot

Axes limits and direction

  • Axes.invert_xaxis
  • Axes.xaxis_inverted
  • Axes.invert_yaxis
  • Axes.yaxis_inverted
  • Axes.set_xlim
  • Axes.get_xlim
  • Axes.set_ylim
  • Axes.get_ylim
  • Axes.update_datalim
  • Axes.update_datalim_bounds
  • Axes.set_xbound
  • Axes.get_xbound
  • Axes.set_ybound
  • Axes.get_ybound

Axes scales

  • Axes.get_xscale
  • Axes.set_xscale
  • Axes.get_yscale
  • Axes.set_yscale

Note: I currently update the docstrings in my private branch https://github.com/timhoffm/matplotlib/tree/axes-plotting-docstrings and will provide a pull request once I'm done. I think this is better than opening a separate pull request for every change. Please let me know, in case you'd rather prefer many smaller PRs.

The fixes will be supplied in a series of PRs referencing this issue.

Activity

  1. jklymak commented on Jan 3, 2018

    @jklymak
    Member

    I think the only disadvantage to a big PR is you may have to privately rebase a bunch, and other folks might make conflicting changes if it takes you a while.

  2. anntzer commented on Jan 3, 2018

    @anntzer
    Contributor

    I would probably make PR with small batches of related methods, but one-at-a-time is fine too.
    A giant PR is also fine as long as you don't mind an unbounded (in time...) review process.

  3. timhoffm commented on Jan 3, 2018

    @timhoffm
    MemberAuthor

    Thanks for the answers. I'll switch to smaller batches then.

  4. ImportanceOfBeingErnest commented on Apr 6, 2018

    @ImportanceOfBeingErnest
    Member

    I think it would be really great if the documentation of a function could link to some (or all?) examples from the gallery that use this function.
    I don't know at which point this would be specified, if it's in the docstring or some sphinx config file?
    Also linking from the examples to the docs is only present in some cases.

  5. jklymak commented on Apr 6, 2018

    @jklymak
    Member

    There is some of that on a few of the pages: https://matplotlib.org/api/_as_gen/matplotlib.patches.Wedge.html#matplotlib.patches.Wedge

    I have no idea from looking at the source how that happens, however.

  6. jklymak commented on Apr 6, 2018

    @jklymak
    Member

    BTW, I like the doc interpolation, but not when someone has named the doscstring something unsearchable like Patch. Does anyone know where the Patch docstring lives that is interpolated via %(Patch)s?

  7. jklymak commented on Apr 6, 2018

    @jklymak
    Member

    ... or is it just auto-generating from the set_ and get_?

  8. ImportanceOfBeingErnest commented on Apr 6, 2018

    @ImportanceOfBeingErnest
    Member

    Yeah, that's exactly what I mean.
    In the page source it says

     .. include:: matplotlib.patches.Wedge.examples
    

    but the question is indeed who is reponsible for putting that line there?

    The %(Patch)s seems to come from

    patchdoc = artist.kwdoc(Patch)
    for k in ('Rectangle', 'Circle', 'RegularPolygon', 'Polygon', 'Wedge', 'Arrow',
    'FancyArrow', 'YAArrow', 'CirclePolygon', 'Ellipse', 'Arc',
    'FancyBboxPatch', 'Patch'):
    docstring.interpd.update({k: patchdoc})
    # define Patch.__init__ docstring after the class has been added to interpd
    docstring.dedent_interpd(Patch.__init__)

    Which then points to

    def kwdoc(a):

    and that seems to indeed give the setters from the classes. But I don't think it will help with creating the examples, or will it?

  9. jklymak commented on Apr 6, 2018

    @jklymak
    Member

    Opening new issue

  10. timhoffm commented on Apr 6, 2018

    @timhoffm
    MemberAuthor

    I'm explicitly excluding work on gallery links from this effort. It's already big enough as it is now. The gallery links have their own ticket #10974.

  11. 2 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions