Skip to content

Remove pylab references #11476

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 1 commit into from
Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/user_interfaces/pylab_with_gtk_sgskip.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
==============
Pylab With GTK
==============
===============
Pyplot With GTK
===============

An example of how to use pylab to manage your figure windows, but
An example of how to use pyplot to manage your figure windows, but
modify the GUI by accessing the underlying gtk widgets
"""
import matplotlib
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Modules include:

:mod:`matplotlib.axes`
defines the :class:`~matplotlib.axes.Axes` class. Most pylab
defines the :class:`~matplotlib.axes.Axes` class. Most pyplot
commands are wrappers for :class:`~matplotlib.axes.Axes`
methods. The axes module is the highest level of OO access to
the library.
Expand Down Expand Up @@ -90,7 +90,7 @@
a function for setting the matplotlib backend. If used, this
function must be called immediately after importing matplotlib
for the first time. In particular, it must be called
**before** importing pylab (if pylab is imported).
**before** importing pyplot (if pyplot is imported).

matplotlib was initially written by John D. Hunter (1968-2012) and is now
developed and maintained by a host of others.
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/backends/backend_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import matplotlib
matplotlib.use('xxx')
from pylab import *
plot([1,2,3])
import matplotlib.pyplot as plt
plt.plot([1,2,3])
show()
Copy link
Member

Choose a reason for hiding this comment

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

This should be plt.show()

Copy link
Member Author

Choose a reason for hiding this comment

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

Handled in #11481


matplotlib also supports external backends, so you can place you can
Expand Down Expand Up @@ -175,7 +175,7 @@ def draw_if_interactive():
def show(block=None):
"""
For image backends - is not required
For GUI backends - show() is usually the last line of a pylab script and
For GUI backends - show() is usually the last line of a pyplot script and
tells the backend that it is time to draw. In interactive mode, this may
be a do nothing func. See the GTK backend for an example of how to handle
interactive versus batch mode
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
"""
Create a colorbar for a ScalarMappable instance, *mappable*.

Documentation for the pylab thin wrapper:
Documentation for the pyplot thin wrapper:
%(colorbar_doc)s
"""
if ax is None:
Expand Down
14 changes: 7 additions & 7 deletions lib/matplotlib/mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,15 +841,15 @@ def _single_spectrum_helper(x, mode, Fs=None, window=None, pad_to=None,
The function applied to each segment before fft-ing,
designed to remove the mean or linear trend. Unlike in
MATLAB, where the *detrend* parameter is a vector, in
matplotlib is it a function. The :mod:`~matplotlib.pylab`
module defines :func:`~matplotlib.pylab.detrend_none`,
:func:`~matplotlib.pylab.detrend_mean`, and
:func:`~matplotlib.pylab.detrend_linear`, but you can use
matplotlib is it a function. The :mod:`~matplotlib.mlab`
module defines :func:`~matplotlib.mlab.detrend_none`,
:func:`~matplotlib.mlab.detrend_mean`, and
:func:`~matplotlib.mlab.detrend_linear`, but you can use
a custom function as well. You can also use a string to choose
one of the functions. 'default', 'constant', and 'mean' call
:func:`~matplotlib.pylab.detrend_mean`. 'linear' calls
:func:`~matplotlib.pylab.detrend_linear`. 'none' calls
:func:`~matplotlib.pylab.detrend_none`.
:func:`~matplotlib.mlab.detrend_mean`. 'linear' calls
:func:`~matplotlib.mlab.detrend_linear`. 'none' calls
:func:`~matplotlib.mlab.detrend_none`.

scale_by_freq : bool, optional
Specifies whether the resulting density values should be scaled
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,7 @@ def plotfile(fname, cols=(0,), plotfuncs=None,
columns.

*comments*, *skiprows*, *checkrows*, *delimiter*, and *names*
are all passed on to :func:`matplotlib.pylab.csv2rec` to
are all passed on to :func:`matplotlib.mlab.csv2rec` to
load the data into a record array.

If *newfig* is *True*, the plot always will be made in a new figure;
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def __init__(self, ax, *args,
"""
The constructor takes one required argument, an Axes
instance, followed by the args and kwargs described
by the following pylab interface documentation:
by the following pyplot interface documentation:
%s
"""
self.ax = ax
Expand Down Expand Up @@ -912,7 +912,7 @@ def __init__(self, ax, *args,
"""
The constructor takes one required argument, an Axes
instance, followed by the args and kwargs described
by the following pylab interface documentation:
by the following pyplot interface documentation:
%(barbs_doc)s
"""
self.sizes = sizes or dict()
Expand Down
15 changes: 5 additions & 10 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,18 +1332,13 @@ class MultiCursor(Widget):
Example usage::

from matplotlib.widgets import MultiCursor
from pylab import figure, show, np
Copy link
Member

Choose a reason for hiding this comment

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

The bare show below needs to be updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Handled in #11481

import matplotlib.pyplot as plt
import numpy as np

fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
t = np.arange(0.0, 2.0, 0.01)
s1 = np.sin(2*np.pi*t)
s2 = np.sin(4*np.pi*t)
fig = figure()
ax1 = fig.add_subplot(211)
ax1.plot(t, s1)


ax2 = fig.add_subplot(212, sharex=ax1)
ax2.plot(t, s2)
ax1.plot(t, np.sin(2*np.pi*t))
ax2.plot(t, np.sin(4*np.pi*t))

multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1,
horizOn=False, vertOn=True)
Expand Down
4 changes: 2 additions & 2 deletions lib/mpl_toolkits/axes_grid1/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class ColorbarBase(cm.ScalarMappable):
Draw a colorbar in an existing axes.

This is a base class for the :class:`Colorbar` class, which is the
basis for the :func:`~matplotlib.pyplot.colorbar` method and pylab
basis for the :func:`~matplotlib.pyplot.colorbar` method and pyplot
function.

It is also useful by itself for showing a colormap. If the *cmap*
Expand Down Expand Up @@ -799,7 +799,7 @@ def colorbar(mappable, cax=None, ax=None, **kw):
"""
Create a colorbar for a ScalarMappable instance.

Documentation for the pylab thin wrapper:
Documentation for the pyplot thin wrapper:

%s
"""
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ def run(self):
Matplotlib strives to produce publication quality 2D graphics
for interactive graphing, scientific publishing, user interface
development and web application servers targeting multiple user
interfaces and hardcopy output formats. There is a 'pylab' mode
which emulates MATLAB graphics.
interfaces and hardcopy output formats.
""",
license="BSD",
packages=packages,
Expand Down