Skip to content

Doc organize axes docs#7176

Merged
NelleV merged 14 commits into
matplotlib:v2.xfrom
tacaswell:doc_organize_axes_docs
Sep 29, 2016
Merged

Doc organize axes docs#7176
NelleV merged 14 commits into
matplotlib:v2.xfrom
tacaswell:doc_organize_axes_docs

Conversation

@tacaswell
Copy link
Copy Markdown
Member

No description provided.

This:

 - makes the axes_api page a collection of tables which are grouped
   reasonably
 - gives each method it's own web page
@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Sep 25, 2016
@tacaswell
Copy link
Copy Markdown
Member Author

http://tacaswell.github.io/matplotlib/api/axes_api.html is what it looks like now.

@efiring
Copy link
Copy Markdown
Member

efiring commented Sep 25, 2016

Wow! What an improvement!

Comment thread doc/api/axes_api.rst

Axes.grid

Axes.get_axis_bgcolor
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we keep the documentation of deprecated methods in here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The way this is currently working, these are what is triggering the auto-generate sub-pages to be created. If we do not include these here then these methods are not documented at all.

Maybe move all the deprecated methods to 'Deprecated' section at the bottom?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that'd be nice, thought as long as these are clearly documented as deprecated (which they are), I am fine with how it is right now.

Comment thread doc/api/axes_api.rst
Axes.get_default_bbox_extra_artists
Axes.get_transformed_clip_path_and_affine
Axes.has_data
Axes.hold
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this is the time to add a "Future Deprecation Warning" to the docstring in view of #3070

If the first line ends in '::', automsummary generates invalid rst
 - remove identical code in YAxis and XAxis, move to Axis
 - add abstract methods on Axis and Tick to make documenting easier
@tacaswell
Copy link
Copy Markdown
Member Author

I took a stab at doing the Axis and Tick API as well.

http://tacaswell.github.io/matplotlib/api/axis_api.html

I think I am going to write a sphinx extension to generate the 'inherited from Artist' sections.

Generated the list of methods / attributes via

for n in sorted(list(set(dir(maxis.Axis)) - set(dir(matplotlib.artist.Artist)))): 
    print('Axis.' + n) if n[0] != '_' else None

There is probably a better way to get this, but this is effective.

Code used to generate this list:

def _recursive_subclasses(cls):
    "Return all subclasses (and their subclasses, etc.)."
    # Source: http://stackoverflow.com/a/3862957/1221924
    return (cls.__subclasses__() +
        [g for s in cls.__subclasses__() for g in _recursive_subclasses(s)])

' '.join(sorted(['.'.join((_.__module__, _.__name__)) for _ in _recursive_subclasses(matplotlib.artist.Artist)]))
@NelleV NelleV changed the title Doc organize axes docs [MRG+1] Doc organize axes docs Sep 26, 2016
Comment thread doc/api/axis_api.rst
===========

.. inheritance-diagram:: Tick Ticker XAxis YAxis XTick YTick
:private-bases:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason for not having the inheritance diagram always at the top (preferable to me) or always at the bottom.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because I thought it went better at the top in Artist and better at the bottom here. The reason for that is that I would expect users to frequently directly use the Axis classes, but not the Tick classes, hence I put the diagram at the bottom. Having now written out this justification, that makes me think that Axis and Tick should get their own pages.

Copy link
Copy Markdown
Member Author

@tacaswell tacaswell Sep 27, 2016

Choose a reason for hiding this comment

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

And I now see this is really at the top so I am not sure what I was remembering...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this could be moved to the bottom for all figures.
Opening a bug #7190.

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Sep 27, 2016

I'll merge this PR in 48hours unless someone has major complaints or updates the PR with new information.
Most of the questions raised by reviewers have led to tickets in our new "overhaul documentation" project: https://github.com/matplotlib/matplotlib/projects/1

@NelleV NelleV merged commit f59e21d into matplotlib:v2.x Sep 29, 2016
@NelleV
Copy link
Copy Markdown
Member

NelleV commented Sep 29, 2016

Thank you @tacaswell ! That's a great improvement on our documentation.

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Sep 29, 2016

Note: those changes should also be added to master.

@tacaswell tacaswell deleted the doc_organize_axes_docs branch September 29, 2016 19:05
@QuLogic QuLogic changed the title [MRG+1] Doc organize axes docs Doc organize axes docs Oct 16, 2016
@WillClaudeHolmes
Copy link
Copy Markdown

@tacaswell, I want to say a big Thank-you for this. I am new to using matplotlib, and I was very confused about how it worked and how to use it. Before this update, I had tried to figure out the object oriented side, but I had little success. It is very understandable now. I am teaching a course in which the students use matplotlib, and this documentation improvement is a big help to me in my course. - Thanks.

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.

6 participants