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

Appearance settings

Commit 5bda1d5

Browse filesBrowse files
committed
DOC: Minor improvements on quick start
- Add `plt.show()` to first example and explain that it may be omitted sometimes rather than not having it in the code and stating that it has to be added sometimes. Reason: a missing show may result in no figure popup and is hard to debug. An extraneous show has no effect. - Figure creation functions: - de-emphasize pyplot. Stating the functions is enough here. We don't need to say where they come from explicitly. In particular we haven't explained the interface distinction yet. So let's be quite about that. - Do not mention/link backends here. That concept is far too advanced and not need here. - Some more wording changes.
1 parent 2e3614c commit 5bda1d5
Copy full SHA for 5bda1d5

File tree

1 file changed

+19
-18
lines changed
Filter options

1 file changed

+19
-18
lines changed

‎galleries/users_explain/quick_start.py

Copy file name to clipboardExpand all lines: galleries/users_explain/quick_start.py
+19-18Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@
2828
# area where points can be specified in terms of x-y coordinates (or theta-r
2929
# in a polar plot, x-y-z in a 3D plot, etc.). The simplest way of
3030
# creating a Figure with an Axes is using `.pyplot.subplots`. We can then use
31-
# `.Axes.plot` to draw some data on the Axes:
31+
# `.Axes.plot` to draw some data on the Axes, and `~.pyplot.show` to display
32+
# the figure:
3233

33-
fig, ax = plt.subplots() # Create a figure containing a single Axes.
34+
fig, ax = plt.subplots() # Create a figure containing a single Axes.
3435
ax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the Axes.
36+
plt.show() # Show the figure.
3537

3638
# %%
3739
#
38-
# Note that to get this Figure to display, you may have to call ``plt.show()``,
39-
# depending on your backend. For more details of Figures and backends, see
40-
# :ref:`figure-intro`.
40+
# Depending on the environment you are working in, ``plt.show()`` can be left
41+
# out. - This is for example the case with Jupyter notebooks, which
42+
# automatically show all figures created in a code cell.
4143
#
4244
# .. _figure_parts:
4345
#
@@ -53,24 +55,24 @@
5355
#
5456
# The **whole** figure. The Figure keeps
5557
# track of all the child :class:`~matplotlib.axes.Axes`, a group of
56-
# 'special' Artists (titles, figure legends, colorbars, etc), and
58+
# 'special' Artists (titles, figure legends, colorbars, etc.), and
5759
# even nested subfigures.
5860
#
59-
# The easiest way to create a new Figure is with pyplot::
61+
# Typically, you'll create a new Figure through one of the following
62+
# functions::
6063
#
61-
# fig = plt.figure() # an empty figure with no Axes
62-
# fig, ax = plt.subplots() # a figure with a single Axes
64+
# fig = plt.figure() # an empty figure with no Axes
65+
# fig, ax = plt.subplots() # a figure with a single Axes
6366
# fig, axs = plt.subplots(2, 2) # a figure with a 2x2 grid of Axes
6467
# # a figure with one Axes on the left, and two on the right:
6568
# fig, axs = plt.subplot_mosaic([['left', 'right_top'],
6669
# ['left', 'right_bottom']])
6770
#
68-
# It is often convenient to create the Axes together with the Figure, but you
69-
# can also manually add Axes later on. Note that many
70-
# :ref:`Matplotlib backends <backends>` support zooming and
71-
# panning on figure windows.
71+
# `~.pyplot.subplots()` and `~.pyplot.subplot_mosaic` are convenience functions
72+
# that additionally create Axes objects inside the Figure, but you can also
73+
# manually add Axes later on.
7274
#
73-
# For more on Figures, see :ref:`figure-intro`.
75+
# For more on Figures, including panning and zooming, see :ref:`figure-intro`.
7476
#
7577
# :class:`~matplotlib.axes.Axes`
7678
# ------------------------------
@@ -85,10 +87,9 @@
8587
# :meth:`~matplotlib.axes.Axes.set_xlabel`), and a y-label set via
8688
# :meth:`~matplotlib.axes.Axes.set_ylabel`).
8789
#
88-
# The :class:`~.axes.Axes` class and its member functions are the primary
89-
# entry point to working with the OOP interface, and have most of the
90-
# plotting methods defined on them (e.g. ``ax.plot()``, shown above, uses
91-
# the `~.Axes.plot` method)
90+
# The `~.axes.Axes` methods are the primary interface for configuring
91+
# most parts of your plot (adding data, controlling axis scales and
92+
# limits, adding labels etc.).
9293
#
9394
# :class:`~matplotlib.axis.Axis`
9495
# ------------------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.