-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cleaned up text in pyplot_tutorial.rst #5147
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
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f1d3c6a
Some minor textual cleanup to the pyplot tutorial.
gcallah 237071c
Added things like to first paragraph.
gcallah d9eda25
Added specifics about which states are saved per tcaswell and put spa…
gcallah b669a5f
Added current image to saved state list.
gcallah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Some minor textual cleanup to the pyplot tutorial.
- Loading branch information
commit f1d3c6a36bbf54c51616a9a87b43f585822622a0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,11 @@ Pyplot tutorial | |
:mod:`matplotlib.pyplot` is a collection of command style functions | ||
that make matplotlib work like MATLAB. | ||
Each ``pyplot`` function makes | ||
some change to a figure: e.g., create a figure, create a plotting area | ||
in a figure, plot some lines in a plotting area, decorate the plot | ||
with labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it | ||
keeps track of the current figure and plotting area, and the plotting | ||
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. In :mod:`matplotlib.pyplot` various states are preserved | ||
across function calls, so that it keeps track of | ||
the current figure and plotting area, and the plotting | ||
functions are directed to the current axes (please note that "axes" here | ||
and in most places in the documentation refers to the *axes* | ||
`part of a figure <http://matplotlib.org/faq/usage_faq.html#parts-of-a-figure>`__ | ||
|
@@ -73,10 +74,11 @@ several ways to set line properties | |
plt.plot(x, y, linewidth=2.0) | ||
|
||
|
||
* Use the setter methods of the ``Line2D`` instance. ``plot`` returns a list | ||
of lines; e.g., ``line1, line2 = plot(x1,y1,x2,y2)``. Below I have only | ||
one line so it is a list of length 1. I use tuple unpacking in the | ||
``line, = plot(x, y, 'o')`` to get the first element of the list:: | ||
* Use the setter methods of a ``Line2D`` instance. ``plot`` returns a list | ||
of ``Line2D`` objects; e.g., ``line1, line2 = plot(x1,y1,x2,y2)``. In the code | ||
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. We could be more consistent in formatting by adding spaces: |
||
below we will suppose that we have only | ||
one line so that the list returned is of length 1. We use tuple unpacking with | ||
``line,`` to get the first element of that list:: | ||
|
||
line, = plt.plot(x, y, '-') | ||
line.set_antialiased(False) # turn off antialising | ||
|
@@ -179,7 +181,7 @@ which allows you to specify the location as ``axes([left, bottom, | |
width, height])`` where all values are in fractional (0 to 1) | ||
coordinates. See :ref:`pylab_examples-axes_demo` for an example of | ||
placing axes manually and :ref:`pylab_examples-subplots_demo` for an | ||
example with lots-o-subplots. | ||
example with lots of subplots. | ||
|
||
|
||
You can create multiple figures by using multiple | ||
|
@@ -204,11 +206,12 @@ as your heart desires:: | |
|
||
You can clear the current figure with :func:`~matplotlib.pyplot.clf` | ||
and the current axes with :func:`~matplotlib.pyplot.cla`. If you find | ||
this statefulness, annoying, don't despair, this is just a thin | ||
it annoying that states, like which figure is current, are being maintained for | ||
you behind the scenes, don't despair: this is just a thin | ||
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. To be fussy: the colon should be a semicolon. |
||
stateful wrapper around an object oriented API, which you can use | ||
instead (see :ref:`artist-tutorial`) | ||
|
||
If you are making a long sequence of figures, you need to be aware of one | ||
If you are making lots of figures, you need to be aware of one | ||
more thing: the memory required for a figure is not completely | ||
released until the figure is explicitly closed with | ||
:func:`~matplotlib.pyplot.close`. Deleting all references to the | ||
|
@@ -266,7 +269,7 @@ Annotating text | |
--------------- | ||
|
||
The uses of the basic :func:`~matplotlib.pyplot.text` command above | ||
place text at an arbitrary position on the Axes. A common use case of | ||
place text at an arbitrary position on the Axes. A common use for | ||
text is to annotate some feature of the plot, and the | ||
:func:`~matplotlib.pyplot.annotate` method provides helper | ||
functionality to make annotations easy. In an annotation, there are | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I would be a bit more explicit about what state is tracked which is only the current figure and axes (there is also a
gci
, but it should not be used).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.
But the saved current image is used by
set_cmap
,clim
, andcolorbar
, so it is an important part of the state.