Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
DOC: Add links to explicit vs implicit API everywhere "OO" is used #22613
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
Changes from all commits
512a006
fe424c5
8c06764
19c9011
c1df30e
7c96ed0
7083aba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,15 +37,15 @@ | |||||
| cells below those that create the plot will change the plot - it is a | ||||||
| live object in memory. | ||||||
|
|
||||||
| This tutorial will use Matplotlib's imperative-style plotting | ||||||
| interface, pyplot. This interface maintains global state, and is very | ||||||
| useful for quickly and easily experimenting with various plot | ||||||
| settings. The alternative is the object-oriented interface, which is also | ||||||
| very powerful, and generally more suitable for large application | ||||||
| development. If you'd like to learn about the object-oriented | ||||||
| interface, a great place to start is our :doc:`Quick start guide | ||||||
| </tutorials/introductory/quick_start>`. For now, let's get on | ||||||
| with the imperative-style approach: | ||||||
| This tutorial will use Matplotlib's implicit plotting interface, pyplot. This | ||||||
| interface maintains global state, and is very useful for quickly and easily | ||||||
| experimenting with various plot settings. The alternative is the explicit, | ||||||
| which is more suitable for large application development. For an explanation | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| of the tradeoffs between the implicit and explicit interfaces See | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| :ref:`api_interfaces` and the :doc:`Quick start guide | ||||||
| </tutorials/introductory/quick_start>` to start using the explicit interface. | ||||||
| For now, let's get on with the implicit approach: | ||||||
|
|
||||||
| """ | ||||||
|
|
||||||
| import matplotlib.pyplot as plt | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,19 +4,20 @@ | |||||
| =============== | ||||||
|
|
||||||
| An introduction to the pyplot interface. Please also see | ||||||
| :doc:`/tutorials/introductory/quick_start` for an overview of how Matplotlib works. | ||||||
| :doc:`/tutorials/introductory/quick_start` for an overview of how Matplotlib | ||||||
| works and :ref:`api_interfaces` for an explanation of the trade-offs between the | ||||||
| supported user APIs. | ||||||
|
|
||||||
| """ | ||||||
|
|
||||||
| ############################################################################### | ||||||
| # Intro to pyplot | ||||||
| # =============== | ||||||
| # | ||||||
| # :mod:`matplotlib.pyplot` is a collection of functions | ||||||
| # that make matplotlib work like MATLAB. | ||||||
| # Each ``pyplot`` function makes | ||||||
| # some change to a figure: e.g., creates a figure, creates a plotting area | ||||||
| # in a figure, plots some lines in a plotting area, decorates the plot | ||||||
| # with labels, etc. | ||||||
| # :mod:`matplotlib.pyplot` is a collection of functions that make matplotlib | ||||||
| # work like MATLAB. Each ``pyplot`` function makes some change to a figure: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| # e.g., creates a figure, creates a plotting area in a figure, plots some lines | ||||||
| # in a plotting area, decorates the plot with labels, etc. | ||||||
| # | ||||||
| # In :mod:`matplotlib.pyplot` various states are preserved | ||||||
| # across function calls, so that it keeps track of things like | ||||||
|
|
@@ -28,10 +29,11 @@ | |||||
| # | ||||||
| # .. note:: | ||||||
| # | ||||||
| # the pyplot API is generally less-flexible than the object-oriented API. | ||||||
| # Most of the function calls you see here can also be called as methods | ||||||
| # from an ``Axes`` object. We recommend browsing the tutorials and | ||||||
| # examples to see how this works. | ||||||
| # the implicit pyplot API is generally less verbose but also not as flexible as the | ||||||
| # explicit API. Most of the function calls you see here can also be called | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| # as methods from an ``Axes`` object. We recommend browsing the tutorials | ||||||
| # and examples to see how this works. See :ref:`api_interfaces` for an | ||||||
| # explanation of the trade off of the supported user APIs. | ||||||
| # | ||||||
| # Generating visualizations with pyplot is very quick: | ||||||
|
|
||||||
|
|
@@ -301,7 +303,7 @@ def f(t): | |||||
| # and the current axes with `~.pyplot.cla`. If you find | ||||||
| # it annoying that states (specifically the current image, figure and axes) | ||||||
| # are being maintained for you behind the scenes, don't despair: this is just a thin | ||||||
| # stateful wrapper around an object oriented API, which you can use | ||||||
| # stateful wrapper around an object-oriented API, which you can use | ||||||
| # instead (see :doc:`/tutorials/intermediate/artists`) | ||||||
| # | ||||||
| # If you are making lots of figures, you need to be aware of one | ||||||
|
|
||||||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.