Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa0b68a

Browse files
committed
docstrings: use standard spelling and capitalization of MATLAB
svn path=/trunk/matplotlib/; revision=8470
1 parent 9f12d1b commit fa0b68a

File tree

10 files changed

+78
-41
lines changed

10 files changed

+78
-41
lines changed

doc/users/intro.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ Introduction
33

44
matplotlib is a library for making 2D plots of arrays in `Python
55
<http://www.python.org>`_. Although it has its origins in emulating
6-
the MATLAB graphics commands, it is
6+
the MATLAB |reg| [*]_ graphics commands, it is
77
independent of MATLAB, and can be used in a Pythonic, object oriented
88
way. Although matplotlib is written primarily in pure Python, it
99
makes heavy use of `NumPy <http://www.numpy.org>`_ and other extension
1010
code to provide good performance even for large arrays.
1111

12+
.. |reg| unicode:: 0xAE
13+
:ltrim:
14+
1215
matplotlib is designed with the philosophy that you should be able to
1316
create simple plots with just a few commands, or just one! If you
1417
want to see a histogram of your data, you shouldn't need to
@@ -87,3 +90,6 @@ from the Python shell in Tkinter on Windows™. My primary use is to
8790
embed matplotlib in a Gtk+ EEG application that runs on Windows, Linux
8891
and Macintosh OS X.
8992

93+
.. [*] MATLAB is a registered trademark of The MathWorks, Inc.
94+
95+

lib/matplotlib/__init__.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
"""
22
This is an object-orient plotting library.
33
4-
A procedural interface is provided by the companion pylab module,
4+
A procedural interface is provided by the companion pyplot module,
55
which may be imported directly, e.g::
66
7+
from pyplot import *
8+
9+
To include numpy functions, use::
10+
711
from pylab import *
812
913
or using ipython::
1014
1115
ipython -pylab
1216
1317
For the most part, direct use of the object-oriented library is
14-
encouraged when programming rather than working interactively. The
15-
exceptions are the pylab commands :func:`~matplotlib.pyplot.figure`,
18+
encouraged when programming; pyplot is primarily for working
19+
interactively. The
20+
exceptions are the pyplot commands :func:`~matplotlib.pyplot.figure`,
1621
:func:`~matplotlib.pyplot.subplot`,
22+
:func:`~matplotlib.pyplot.subplots`,
1723
:func:`~matplotlib.backends.backend_qt4agg.show`, and
1824
:func:`~pyplot.savefig`, which can greatly simplify scripting.
1925
@@ -86,6 +92,10 @@
8692
8793
matplotlib is written by John D. Hunter (jdh2358 at gmail.com) and a
8894
host of others.
95+
96+
Occasionally the internal documentation (python docstrings) will refer
97+
to MATLAB&reg;, a registered trademark of The MathWorks, Inc.
98+
8999
"""
90100
from __future__ import generators
91101

@@ -897,7 +907,7 @@ def tk_window_focus():
897907

898908
# Now allow command line to override
899909

900-
# Allow command line access to the backend with -d (matlab compatible
910+
# Allow command line access to the backend with -d (MATLAB compatible
901911
# flag)
902912

903913
for s in sys.argv[1:]:

lib/matplotlib/artist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,10 +1159,10 @@ def setp(obj, *args, **kwargs):
11591159
>>> lines = plot(x, y1, x, y2)
11601160
>>> setp(lines, linewidth=2, color='r')
11611161
1162-
:func:`setp` works with the matlab style string/value pairs or
1162+
:func:`setp` works with the MATLAB style string/value pairs or
11631163
with python kwargs. For example, the following are equivalent::
11641164
1165-
>>> setp(lines, 'linewidth', 2, 'color', r') # matlab style
1165+
>>> setp(lines, 'linewidth', 2, 'color', r') # MATLAB style
11661166
11671167
>>> setp(lines, linewidth=2, color='r') # python style
11681168
"""

lib/matplotlib/axes.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _string_to_bool(s):
5050

5151
def _process_plot_format(fmt):
5252
"""
53-
Process a matlab(TM) style color/line style format string. Return a
53+
Process a MATLAB style color/line style format string. Return a
5454
(*linestyle*, *color*) tuple as a result of the processing. Default
5555
values are ('-', 'b'). Example format strings include:
5656
@@ -1963,7 +1963,7 @@ def grid(self, b=None, which='major', **kwargs):
19631963
19641964
grid(self, b=None, which='major', **kwargs)
19651965
1966-
Set the axes grids on or off; *b* is a boolean. (For Matlab
1966+
Set the axes grids on or off; *b* is a boolean. (For MATLAB
19671967
compatibility, *b* may also be a string, 'on' or 'off'.)
19681968
19691969
If *b* is *None* and ``len(kwargs)==0``, toggle the grid state. If
@@ -5187,7 +5187,7 @@ def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
51875187
51885188
- *vert* = 1 (default) makes the boxes vertical.
51895189
- *vert* = 0 makes horizontal boxes. This seems goofy, but
5190-
that's how Matlab did it.
5190+
that's how MATLAB did it.
51915191
51925192
*whis* (default 1.5) defines the length of the whiskers as
51935193
a function of the inner quartile range. They extend to the
@@ -6744,7 +6744,7 @@ def pcolor(self, *args, **kwargs):
67446744
*shading*: [ 'flat' | 'faceted' ]
67456745
If 'faceted', a black grid is drawn around each rectangle; if
67466746
'flat', edges are not drawn. Default is 'flat', contrary to
6747-
Matlab.
6747+
MATLAB.
67486748
67496749
This kwarg is deprecated; please use 'edgecolors' instead:
67506750
* shading='flat' -- edgecolors='none'
@@ -6765,7 +6765,7 @@ def pcolor(self, *args, **kwargs):
67656765
67666766
.. _axes-pcolor-grid-orientation:
67676767
6768-
The grid orientation follows the Matlab(TM) convention: an
6768+
The grid orientation follows the MATLAB convention: an
67696769
array *C* with shape (*nrows*, *ncolumns*) is plotted with
67706770
the column number as *X* and the row number as *Y*, increasing
67716771
up; hence it is plotted the way the array would be printed,
@@ -6800,7 +6800,7 @@ def pcolor(self, *args, **kwargs):
68006800
68016801
pcolor(C.T)
68026802
6803-
Matlab :func:`pcolor` always discards the last row and column
6803+
MATLAB :func:`pcolor` always discards the last row and column
68046804
of *C*, but matplotlib displays the last row and column if *X* and
68056805
*Y* are not specified, or if *X* and *Y* have one more row and
68066806
column than *C*.
@@ -6942,7 +6942,7 @@ def pcolormesh(self, *args, **kwargs):
69426942
*shading*: [ 'flat' | 'faceted' | 'gouraud' ]
69436943
If 'faceted', a black grid is drawn around each rectangle; if
69446944
'flat', edges are not drawn. Default is 'flat', contrary to
6945-
Matlab(TM).
6945+
MATLAB.
69466946
69476947
This kwarg is deprecated; please use 'edgecolors' instead:
69486948
* shading='flat' -- edgecolors='None'
@@ -8219,14 +8219,14 @@ def __init__(self, fig, *args, **kwargs):
82198219
raise ValueError('Argument to subplot must be a 3 digits long')
82208220
rows, cols, num = map(int, s)
82218221
self._subplotspec = GridSpec(rows, cols)[num-1]
8222-
# num - 1 for converting from matlab to python indexing
8222+
# num - 1 for converting from MATLAB to python indexing
82238223
elif len(args)==3:
82248224
rows, cols, num = args
82258225
if isinstance(num, tuple) and len(num) == 2:
82268226
self._subplotspec = GridSpec(rows, cols)[num[0]-1:num[1]]
82278227
else:
82288228
self._subplotspec = GridSpec(rows, cols)[num-1]
8229-
# num - 1 for converting from matlab to python indexing
8229+
# num - 1 for converting from MATLAB to python indexing
82308230
else:
82318231
raise ValueError( 'Illegal argument to subplot')
82328232

lib/matplotlib/backend_bases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ def get_linewidth(self):
702702
def get_rgb(self):
703703
"""
704704
returns a tuple of three floats from 0-1. color can be a
705-
matlab format string, a html hex color string, or a rgb tuple
705+
MATLAB format string, a html hex color string, or a rgb tuple
706706
"""
707707
return self._rgb
708708

@@ -781,7 +781,7 @@ def set_dashes(self, dash_offset, dash_list):
781781

782782
def set_foreground(self, fg, isRGB=False):
783783
"""
784-
Set the foreground color. fg can be a matlab format string, a
784+
Set the foreground color. fg can be a MATLAB format string, a
785785
html hex color string, an rgb unit tuple, or a float between 0
786786
and 1. In the latter case, grayscale is used.
787787
@@ -2072,7 +2072,7 @@ def stop_event_loop_default(self):
20722072

20732073
class FigureManagerBase:
20742074
"""
2075-
Helper class for matlab mode, wraps everything up into a neat bundle
2075+
Helper class for pyplot mode, wraps everything up into a neat bundle
20762076
20772077
Public attibutes:
20782078

lib/matplotlib/blocking_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def mouse_event_stop( self, event ):
194194
BlockingInput.pop(self,-1)
195195

196196
# This will exit even if not in infinite mode. This is
197-
# consistent with matlab and sometimes quite useful, but will
197+
# consistent with MATLAB and sometimes quite useful, but will
198198
# require the user to test how many points were actually
199199
# returned before using data.
200200
self.fig.canvas.stop_event_loop()

lib/matplotlib/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,8 +1234,8 @@ def _initialize_x_y(self, z):
12341234
filled contours, respectively. Except as noted, function
12351235
signatures and return values are the same for both versions.
12361236
1237-
:func:`~matplotlib.pyplot.contourf` differs from the Matlab
1238-
(TM) version in that it does not draw the polygon edges.
1237+
:func:`~matplotlib.pyplot.contourf` differs from the MATLAB
1238+
version in that it does not draw the polygon edges.
12391239
To draw edges, add line contours with
12401240
calls to :func:`~matplotlib.pyplot.contour`.
12411241

lib/matplotlib/mlab.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
3-
Numerical python functions written for compatability with matlab(TM)
3+
Numerical python functions written for compatability with MATLAB
44
commands with the same names.
55
6-
Matlab(TM) compatible functions
6+
MATLAB compatible functions
77
-------------------------------
88
99
:func:`cohere`
@@ -41,10 +41,10 @@
4141
Miscellaneous functions
4242
-------------------------
4343
44-
Functions that don't exist in matlab(TM), but are useful anyway:
44+
Functions that don't exist in MATLAB, but are useful anyway:
4545
4646
:meth:`cohere_pairs`
47-
Coherence over all pairs. This is not a matlab function, but we
47+
Coherence over all pairs. This is not a MATLAB function, but we
4848
compute coherence a lot in my lab, and we compute it for a lot of
4949
pairs. This function is optimized to do this efficiently by
5050
caching the direct FFTs.
@@ -245,7 +245,7 @@ def _spectral_helper(x, y, NFFT=256, Fs=2, detrend=detrend_none,
245245
raise ValueError("sides must be one of: 'default', 'onesided', or "
246246
"'twosided'")
247247

248-
# Matlab divides by the sampling frequency so that density function
248+
# MATLAB divides by the sampling frequency so that density function
249249
# has units of dB/Hz and can be integrated by the plotted frequency
250250
# values. Perform the same scaling here.
251251
if scale_by_freq:
@@ -277,18 +277,18 @@ def _spectral_helper(x, y, NFFT=256, Fs=2, detrend=detrend_none,
277277
Pxy[:,i] = np.conjugate(fx[:numFreqs]) * fy[:numFreqs]
278278

279279
# Scale the spectrum by the norm of the window to compensate for
280-
# windowing loss; see Bendat & Piersol Sec 11.5.2.
280+
# windowing loss; see Bendat & Piersol Sec 11.5.2.
281281
Pxy *= 1 / (np.abs(windowVals)**2).sum()
282282

283283
# Also include scaling factors for one-sided densities and dividing by the
284284
# sampling frequency, if desired. Scale everything, except the DC component
285-
# and the NFFT/2 component:
285+
# and the NFFT/2 component:
286286
Pxy[1:-1] *= scaling_factor
287287

288-
#But do scale those components by Fs, if required
288+
#But do scale those components by Fs, if required
289289
if scale_by_freq:
290-
Pxy[[0,-1]] /= Fs
291-
290+
Pxy[[0,-1]] /= Fs
291+
292292
t = 1./Fs * (ind + NFFT / 2.)
293293
freqs = float(Fs) / pad_to * np.arange(numFreqs)
294294

@@ -315,7 +315,7 @@ def _spectral_helper(x, y, NFFT=256, Fs=2, detrend=detrend_none,
315315
*detrend*: callable
316316
The function applied to each segment before fft-ing,
317317
designed to remove the mean or linear trend. Unlike in
318-
matlab, where the *detrend* parameter is a vector, in
318+
MATLAB, where the *detrend* parameter is a vector, in
319319
matplotlib is it a function. The :mod:`~matplotlib.pylab`
320320
module defines :func:`~matplotlib.pylab.detrend_none`,
321321
:func:`~matplotlib.pylab.detrend_mean`, and
@@ -356,7 +356,7 @@ def _spectral_helper(x, y, NFFT=256, Fs=2, detrend=detrend_none,
356356
Specifies whether the resulting density values should be scaled
357357
by the scaling frequency, which gives density in units of Hz^-1.
358358
This allows for integration over the returned frequency values.
359-
The default is True for MatLab compatibility.
359+
The default is True for MATLAB compatibility.
360360
"""))
361361

362362
@docstring.dedent_interpd
@@ -785,7 +785,7 @@ def prepca(P, frac=0):
785785
- *fracVar* : the fraction of the variance accounted for by each
786786
component returned
787787
788-
A similar function of the same name was in the Matlab (TM)
788+
A similar function of the same name was in the MATLAB
789789
R13 Neural Network Toolbox but is not found in later versions;
790790
its successor seems to be called "processpcs".
791791
"""
@@ -1732,7 +1732,7 @@ def ispower2(n):
17321732

17331733
def isvector(X):
17341734
"""
1735-
Like the Matlab (TM) function with the same name, returns *True*
1735+
Like the MATLAB function with the same name, returns *True*
17361736
if the supplied numpy array or matrix *X* looks like a vector,
17371737
meaning it has a one non-singleton axis (i.e., it can have
17381738
multiple axes, but all must have length 1, except for one of
@@ -2719,7 +2719,7 @@ def griddata(x,y,z,xi,yi,interp='nn'):
27192719
# remove masked points.
27202720
if hasattr(z,'mask'):
27212721
# make sure mask is not a scalar boolean array.
2722-
if a.mask.ndim:
2722+
if a.mask.ndim:
27232723
x = x.compress(z.mask == False)
27242724
y = y.compress(z.mask == False)
27252725
z = z.compressed()

lib/matplotlib/pylab.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
plotting library.
44
55
The following plotting commands are provided; the majority have
6-
Matlab(TM) analogs and similar argument.
6+
MATLAB |reg| [*]_ analogs and similar arguments.
7+
8+
.. |reg| unicode:: 0xAE
79
810
_Plotting commands
911
acorr - plot the autocorrelation function
@@ -197,6 +199,9 @@
197199
198200
__end
199201
202+
.. [*] MATLAB is a registered trademark of The MathWorks, Inc.
203+
204+
200205
"""
201206
import sys, warnings
202207

lib/matplotlib/pyplot.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
Provides a MATLAB-like plotting framework.
3+
4+
:mod:`~matplotlib.pylab` combines pyplot with numpy into a single namespace.
5+
This is convenient for interactive work, but for programming it
6+
is recommended that the namespaces be kept separate, e.g.::
7+
8+
import numpy as np
9+
import matplotlib.pyplot as plt
10+
11+
x = np.arange(0, 5, 0.1);
12+
y = np.sin(x)
13+
plt.plot(x, y)
14+
15+
"""
16+
117
import sys
218

319
import matplotlib
@@ -197,7 +213,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
197213
198214
If *num* is an integer, and ``figure(num)`` already exists, make it
199215
active and return a reference to it. If ``figure(num)`` does not exist
200-
it will be created. Numbering starts at 1, matlab style::
216+
it will be created. Numbering starts at 1, MATLAB style::
201217
202218
figure(1)
203219
@@ -739,7 +755,7 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
739755
subplot_kw['sharey'] = ax0
740756
axarr[0] = ax0
741757

742-
# Note off-by-one counting because add_subplot uses the matlab 1-based
758+
# Note off-by-one counting because add_subplot uses the MATLAB 1-based
743759
# convention.
744760
for i in range(1, nplots):
745761
axarr[i] = fig.add_subplot(nrows, ncols, i+1, **subplot_kw)
@@ -947,7 +963,7 @@ def axis(*v, **kwargs):
947963
changes *x* and *y* axis limits such that all data is shown. If
948964
all data is already shown, it will move it to the center of the
949965
figure without modifying (*xmax* - *xmin*) or (*ymax* -
950-
*ymin*). Note this is slightly different than in matlab.
966+
*ymin*). Note this is slightly different than in MATLAB.
951967
952968
>>> axis('image')
953969

0 commit comments

Comments
 (0)