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

DOC: simplify API index#19727

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
timhoffm merged 9 commits intomatplotlib:masterfromjklymak:doc-api-frontpage
Mar 24, 2021
Merged

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedMar 17, 2021
edited
Loading

PR Summary

This yields a much quicker ingress to the useful parts of the API page, and a quick example to orient the reader...

API

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak
Copy link
MemberAuthor

jklymak commentedMar 18, 2021
edited
Loading

@jklymakjklymak added this to thev3.5.0 milestoneMar 18, 2021
@timhoffm
Copy link
Member

We had API in the top menu untilhttps://matplotlib.org/3.1.0/. I think it was removed intentionally, but don't remember the discussion.

@jklymak
Copy link
MemberAuthor

Yes, it was removed here:https://github.com/matplotlib/matplotlib/pull/15489/files I don't see much discussion of dropping API...

Comment on lines 19 to 21
(Note that there is also a parallel `matplotlib.pyplot` API interface
that is considered useful for interactive work; see
:ref:`usage patterns <usage_patterns>`, below).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(Note that there is also a parallel `matplotlib.pyplot` API interface
that is considered useful for interactive work; see
:ref:`usage patterns<usage_patterns>`, below).
Alternatively, there is also a parallel `matplotlib.pyplot` API interface
that is considered useful for interactive work; see
:ref:`usage patterns<usage_patterns>`, below.

Copy link
Member

Choose a reason for hiding this comment

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

But I'm not sure we should mention the distinction here at all. Particularly also because the following example uses the object-based approach, but still needs to use pyplot for Figure and Axes creation. It's quite confusing that the non-pyplot approach still needs pyplot. So, I'd not go into the details here.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Sure - I struggled a bit with how to work this in, or if I should. It is such a common point of confusion that someone wrote a whole section and stuck it at the top of the API docs, so it seemed at least referring to it near the top would be useful, but I'm happy to leave it out.


The pylab API (disapproved)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
fig, ax = plt.subplots(figsize=(3,2), constrained_layout=True)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fig, ax = plt.subplots(figsize=(3,2), constrained_layout=True)
fig, ax = plt.subplots()

Keep it simple without parameters. Whileconstrained_layout is nice, IMHO this is not the place to teach it (and the benefit for this simple plot is small).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yes, but then the figure is too large, in my opinion.

Copy link
Member

Choose a reason for hiding this comment

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

You could try with

.. plot::   :scale: 50 %

but I'm not sure if that will look good.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, I wish there was a two-column view.... We could just include the code and the figure as an image as well. I do think the example is useful, though, to make it concrete what we are talking about.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

By default, the ylabel is cutoff, sosome formatting is necessary anyway.. Might as well keep what is above. I don't think we need to explain every incantation everywhere it appears.

jklymakand others added2 commitsMarch 18, 2021 13:22
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
ax.plot(x, y)
ax.set_xlabel('t [s]')
ax.set_ylabel('S [V]')
fig.suptitle('Sine wave')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fig.suptitle('Sine wave')
ax.set_title('Sine wave')
fig.patch.set_color('lightsteelblue')

One would not usefig.suptitle with a single Axes. This looks a bit odd because the title is centered on the figure not the Axes. There are actually not too many reasonable uses for figure methods in this simple example. Coloring the background may be one of the better ones.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Are we trying to soft deprecatefig.set_facecolor? I understand not wanting duplicate ways of doing the same thing, but asking folks to modify a property like this is a discoverability issue.


Modules
-------

Matplotlib consists of the following submodules:
Alphabetical list of submodules:

.. toctree::
:maxdepth: 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
:maxdepth: 1
:maxdepth: 1
:multicol-toc:

Maybe.
grafik

jklymak reacted with heart emoji
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 unreleased? I get/Users/jklymak/matplotlib/doc/api/index.rst:45: WARNING: Error in "toctree" directive: unknown option: "multicol-toc". on sphinx 3.5.3

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, this should have been:class: multicol-toc.

multicol-toc is just a CSS class we have added to ourmpl.css.

Copy link
MemberAuthor

@jklymakjklymakMar 21, 2021
edited
Loading

Choose a reason for hiding this comment

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

oops searched the internet - didn't think to search our source code...

Copy link
Member

Choose a reason for hiding this comment

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

Sorry this does not seem to work... toctree: does not support a:class: attribute.

I've otherwise only used it for.. contents: so far. The above screenshot was a hacked CSS in the browser, because I didn't want to wait for a docs build.

Seems we have to live with the long list for now.

tacaswell reacted with laugh emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Ha! I thought I was going crazy... Certainly adding a class directive to toctree seems like a good idea, but seems like an upstream issue.

timhoffm reacted with thumbs up emoji
@tacaswell
Copy link
Member

I'm good with this as it is now, but did not catch up on the full discussion so am holding off on merging.

@jklymakjklymak requested a review fromtimhoffmMarch 24, 2021 20:32
Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Certainly an improvement. Thanks@jklymak!

@timhoffmtimhoffm merged commit1937d0b intomatplotlib:masterMar 24, 2021
@jklymakjklymak deleted the doc-api-frontpage branchMarch 24, 2021 23:21
@jklymak
Copy link
MemberAuthor

Thanks both!

@jklymakjklymak mentioned this pull requestAug 29, 2023
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.5.0
Development

Successfully merging this pull request may close these issues.

3 participants
@jklymak@timhoffm@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp