8000 SG for toolkits by choldgraf · Pull Request #8573 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

SG for toolkits #8573

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
May 18, 2017
Merged

SG for toolkits #8573

merged 5 commits into from
May 18, 2017

Conversation

choldgraf
Copy link
Contributor

This PR converts the toolkits section into a sphinx-gallery API. It also adds a toolkits section to the tutorials page and moves the manuals there.

@choldgraf choldgraf force-pushed the sg_mpl_toolkit branch 4 times, most recently from ead77c1 to 71d6118 Compare May 5, 2017 04:33
@choldgraf
Copy link
Contributor Author

pretty sure travis error is not related to this PR

@QuLogic
Copy link
Member
QuLogic commented May 5, 2017

What is ntbk? You've also accidentally added a few IPython notebook checkpoint files which, being rather large, should be excised from the repo completely.

@choldgraf
Copy link
Contributor Author

shit - my bad, those are just my own personal temporary notebooks that I use for debugging matlab. removed in latest push

@choldgraf
Copy link
Contributor Author

I was wondering why there were so many changed files in this PR :P

@choldgraf
Copy link
Contributor Author

not sure what this error is about - it seems to be about pandas datetimes or something

@choldgraf choldgraf mentioned this pull request May 6, 2017
11 tasks
@WeatherGod
Copy link
Member

I think the pandas issue was fixed in master? Could you rebase and force-push, please?

@choldgraf
Copy link
Contributor Author

ok just pushed a rebase

Copy link
Member
@WeatherGod WeatherGod left a comment

Choose a reason for hiding this comment

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

Mostly focused on mplot3d-related things.

:toctree: ../_as_gen
:template: automodule.rst

axes_grid
Copy link
Member

Choose a reason for hiding this comment

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

A decision needs to be made about what to do with axes_grid. We have been putting these warnings up for its use (telling people to use axes_grid1 and axisartist, but it is all very confusing to end-users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My opinion is to get rid of axes_grid in the documentation if you want people to stop using it and axes_grid1 has been around for a while. I can say at least from personal experience it's super confusing what the difference between the two is...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can remove this in the api page in this PR and include a link to the old documentation in previous 2.x iterations in the axes_grid1 page. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

latest push has this in there

:toctree: ../_as_gen
:template: autosummary.rst

axes3d.Axes
Copy link
Member

Choose a reason for hiding this comment

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

This is just an import of the 2d base axes class. Take it out


axes3d.Axes
axes3d.Axes3D
axes3d.Bbox
Copy link
Member

Choose a reason for hiding this comment

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

Just an import of the 2d bbox class. Take it out.

axes3d.Bbox
axes3d.LightSource
axes3d.Normalize
axes3d.Triangulation
Copy link
Member

Choose a reason for hiding this comment

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

These three are also just imports from the core matplotlib. The only thing from this list to be kept is Axes3D.

axis3d.ZAxis
axis3d.get_flip_min_max
axis3d.move_from_center
axis3d.tick_update_position
Copy link
Member

Choose a reason for hiding this comment

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

Again, I would keep only axis3d.Axis. Everything else is either uninformative, or not intended for the end-users.

art3d.poly_collection_2d_to_3d
art3d.rotate_axes
art3d.text_2d_to_3d
art3d.zalpha
Copy link
Member

Choose a reason for hiding this comment

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

The top 8 items (the 3d artist classes) should definitely be kept. The rest of these... I would think they would be clutter. At the very least, they should be separated out, as they are more utility-like than anything else. I do see that they are included in the current documentation, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I separated them out into a separate set of utility functions

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense

e.g., x2, y2 = trans(x1, y1)
should return two target coordinates.::

e.g., x2, y2 = trans(x1, y1)
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure this is right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

most of these I'm just converting the rST so that it renders as code properly...I don't think I have the expertise to fix bugs in the actual implementations etc

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 not what I meant. I meant that this isn't supposed to be a codeblock. "e.g.," isn't code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gah crap you're right - I'll just make it "e.g., x2, y2 = trans(x1, y1)" sounds good?

Copy link
Member

Choose a reason for hiding this comment

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

yup. that's what I think it should be.

The mplot3d Toolkit
===================

Generating 3D plots the mplot3d toolkit.
Copy link
Member

Choose a reason for hiding this comment

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

missing word, "using"

@choldgraf
Copy link
Contributor Author

comments etc addressed I believe

@choldgraf
Copy link
Contributor Author

@WeatherGod LMK! Trying to clean up the open PRs I have now...

@choldgraf
Copy link
Contributor Author

ping! or somebody else wanna take a look? Maybe @story645 ?

Copy link
Member
@story645 story645 left a comment

Choose a reason for hiding this comment

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

lots of copy editing notes that are probably referring to copy you didn't write. :( sorry about that and feel free to ignore/tell me to hijack your PR and make the edits myself)

---------
.. note::

There is an older version of the AxesGrid toolkit, simply called ``axes_grid`` instead of
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 this is all you need:

There is an older version of the AxesGrid toolkit, called axes_grid


There is an older version of the AxesGrid toolkit, simply called ``axes_grid`` instead of
``axes_grid1``. the toolkit had a single namespace of axes_grid. This toolkit was broken
into the two modules below. For the documentation on the original ``axes_grid``
Copy link
Member

Choose a reason for hiding this comment

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

For the documentation on axes_grid

basically distinguish them just as axes_grid and `axes_grid1``

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good - but gosh, this is a confusing API choice :-P

Copy link
Member

Choose a reason for hiding this comment

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

When I teach colleagues about making good design decisions early on, I always use this as an example of what can happen when hasty decisions are made.

.. note::
Historically, axis3d has suffered from having hard-coded constants
controlling the look and feel of the 3D plot. This precluded user
level adjustments such as label spacing, font colors and panel colors.
Copy link
Member

Choose a reason for hiding this comment

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

This precludes because the following sentence indicates that these hard-coded constants are still part of the module.

Copy link
Member

Choose a reason for hiding this comment

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

No, the hard-coded constants are gone (at least, for the most part).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describ F42D e this comment to others. Learn more.

Yeah, it's the "for the most part" that's unclear here. What do the current hardcoded constants affect and does the user need to know about it.

Copy link
Member

Choose a reason for hiding this comment

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

The problem is that the 3d axis objects aren't done the same as any other axis objects. There are still some hard-coded constants, but they don't have anything to do with normal axis properties, so it is difficult to map those concepts back to what users would know.

The important thing is to remember the context. Pre v1.1.0, you couldn't configure anything in mplot3d. Users aren't precluded from configuring mplot3d any more.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, so what about this note do users need to know?

Copy link
Member

Choose a reason for hiding this comment

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

The entire note is useful information to the end-user that wants to fully customize the mplot3d properties. The note has been there since v1.1.0. The kludge dictionary still exists, hence the note is still needed to document it.

I think we have spent enough time discussing this note. If you wish to eliminate this note, then please re-implement all of axis3d so that it would work like a normal axis object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you wish to eliminate this note

I don't believe that @story645 wishes to eliminate the note, I think they just want to make sure the information is as clear as possible. For example, the most important bit of information lies at the very end of the note. I'd propose that we move it to the beginning, so something like:

"
See mpl_toolkits.mplot3d.axis3d._axinfo for a dictionary containing constants that may be modified for controlling the look and feel of mplot3d axes (e.g., label spacing, font colors and panel colors). Historically, axis3d has suffered from having hard-coded constants that precluded user adjustments, and this dictionary was implemented in version 1.1 as a stop-gap measure.
"
I think that pushes the most important information (the name _axinfo and what it does) to the front. WDYT @WeatherGod ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to make that wording switch or to leave it the way it is...just throwing this out there since I'm already taking a pass through the code. LMK what you'd prefer!

Copy link
Member

Choose a reason for hiding this comment

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

I am fine with that proposed change.

Copy link
Member
@story645 story645 May 16, 2017

Choose a reason for hiding this comment

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

@WeatherGod I'm sorry, I should have phrased my comment better. Like @choldgraf said, I found the note really confusing as to what the user could and couldn't now modify. I really like @choldgraf's new wording.

@@ -3,9 +3,11 @@
Matplotlib axisartist Toolkit
=============================

.. toctree::
:maxdepth: 2
The *axisartist* namespace includes a derived Axes implementation. The
Copy link
Member

Choose a reason for hiding this comment

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

link to the derived Axes implementation?

.. toctree::
:maxdepth: 2
The *axisartist* namespace includes a derived Axes implementation. The
biggest difference is that the artists responsible to draw axis line,
Copy link
Member

Choose a reason for hiding this comment

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

for drawing the (is this the axis spine?), ticks, tick labels, and labels on an axis

axisartist with ParasiteAxes
----------------------------

Most commands in the axes_grid1 toolkit can take a axes_class keyword
Copy link
Member

Choose a reason for hiding this comment

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

an axes_class keyword

----------------------------

Most commands in the axes_grid1 toolkit can take a axes_class keyword
argument, and the commands creates an axes of the given class. For example,
Copy link
Member

Choose a reason for hiding this comment

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

commands create an axes

host = host_subplot(111, axes_class=AA.Axes)


Here is an example that uses parasiteAxes.
Copy link
Member

Choose a reason for hiding this comment

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

two spaces between uses and parasiteAxes..and link to parasiteAxes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure where the parasiteAxes class is...the example doesn't actually import it. Any idea?

Curvilinear Grid
----------------

The motivation behind the AxisArtist module is to support curvilinear grid
Copy link
Member

Choose a reason for hiding this comment

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

support a curvilinear grid

Floating Axes
-------------

This also support a Floating Axes whose outer axis are defined as
Copy link
Member

Choose a reason for hiding this comment

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

This [something] also supports

outer axis? (some singular plural weirdness here)

@choldgraf
Copy link
Contributor Author

@story645 I'm happy to make these copy edits if you're happy to merge after I make them ;-) assuming that @WeatherGod is OK with the changes I made of course

@WeatherGod
Copy link
Member

My approval is for the mplot3d side of things. I probably won't get around to reviewing the other toolkit's docs.

@choldgraf
Copy link
Contributor Author

OK @story645, I think most of these comments are addressed (except where I note clarifying questions)

In the future, I am 100% fine with you just directly editing the PR with these changes. For small wording changes, type-os, etc, it's a waste of time for you to take a pass through and type out all of the changes as comments, and then to have me go back through and enter them all into the PR.

Actually on that note, I'd be a fan of codifying this as official MPL documentation PR protocol. Comments are purely high-level stuff, and then just before merging there is a copy-editing pass that directly edits the PR before (squashing if necessary) merging.

@story645
Copy link
Member

Totally agree with you on codifying, but not quite sure where...maybe here: http://matplotlib.org/devdocs/devel/contributing.html#contributing-pull-requests

@story645
Copy link
Member

Also let me know if you're ready to merge.

@choldgraf
Copy link
Contributor Author

@story645 I just squashed those copy-edits + added a quick CSS change that @QuLogic pointed out was causing problems w/ link colors. Should be good to go if tests pass.

@choldgraf
Copy link
Contributor Author

ok that looks good - feel free to merge @story645 (the last commit was just 2 lines of CSS so won't affect tests)

@choldgraf
Copy link
Contributor Author

actually it looks like there are some weird build errors - any idea what's going on w/ Travis @story645 ?

@choldgraf
Copy link
Contributor Author

Looks like it's a bug in sphinx, see comment from @dstansby in the gitter

@dstansby
Copy link
Member

I don't have time for a PR at the moment, but forcing pip to install sphinx=1.5.6 in .travis.yml should fix the problem.

@choldgraf
Copy link
Contributor Author

@dstansby don't you figure sphinx will release a patch pretty quickly?

@dstansby
Copy link
Member

It's a sphinx-gallery issue, not a sphinx issue, so I'm not sure how quick a fix will be.

@choldgraf
Copy link
Contributor Author

I made a PR to fix it so hopefully not too long

@story645
Copy link
Member

So should I merge or wait on the bug fix?

@choldgraf
Copy link
Contributor Author

What version of sphinx does MPL use for the website? If it's the latest then the error will pop up there too :-/

@jenshnielsen
Copy link
Member

The matplotlib.org/devdocs is build automatically by Travis so that would fail too. The main webpage is build manually. I would exclude Sphinx <1.6.0 for now

@QuLogic QuLogic added this to the 2.1 (next point release) milestone May 17, 2017
Copy link
Member
@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

I'd merge, but it doesn't appear to be building.

{% for item in classes %}
{{ item }}
{% endfor %}
{% for item in classes %}{% if item not in ['zip', 'map', 'reduce'] %}
Copy link
Member

Choose a reason for hiding this comment

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

Are these really classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for some reason they were popping up in the docs so I hard-coded them in...I'm not really sure why they were doing that

objects, and in the new version this toolkit was broken
into the two modules below. For the documentation on ``axes_grid``,
see the `previous version of the docs
<http://matplotlib.org/2.0.1/mpl_toolkits/axes_grid/index.html#toolkit-axesgrid-index>`_.
Copy link
Member

Choose a reason for hiding this comment

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

https

See :attr:`mpl_toolkits.mplot3d.axis3d._axinfo` for a dictionary containing
constants that may be modified for controlling the look and feel
of mplot3d axes (e.g., label spacing, font colors and panel colors).
Historically, axis3d has suffered from having hard-coded constants
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 this extra space is breaking the build.

741A

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch

@choldgraf
Copy link
Contributor Author

small changes made - I see that we have a PR that downgrades sphinx to 1.5.x so I think we are OK.

@QuLogic
Copy link
Member
QuLogic commented May 18, 2017

CI sure seems slow today.

@QuLogic QuLogic merged commit 5efa5c3 into matplotlib:master May 18, 2017
@choldgraf
Copy link
Contributor Author

yahoo! 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
0