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

Skip to content

Commit 42ff471

Browse files
committed
Plot accepts scalar coordinates, e.g. plot(1, 2, 'r*')
svn path=/trunk/matplotlib/; revision=7294
1 parent 3fc0407 commit 42ff471

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2009-07-25 Allow "plot(1, 2, 'r*')" to work. - EF
2+
13
2009-07-22 Added an 'interp' keyword to griddata so the faster linear
24
interpolation method can be chosen. Default is 'nn', so
35
default behavior (using natural neighbor method) is unchanged (JSW)

lib/matplotlib/axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ def _xy_from_xy(self, x, y):
223223
if by:
224224
y = self.axes.convert_yunits(y)
225225

226-
x = ma.asarray(x)
227-
y = ma.asarray(y)
228-
if len(x.shape) == 1:
226+
x = ma.asarray(np.atleast_1d(x))
227+
y = ma.asarray(np.atleast_1d(y))
228+
if x.ndim == 1:
229229
x = x[:,np.newaxis]
230-
if len(y.shape) == 1:
230+
if y.ndim == 1:
231231
y = y[:,np.newaxis]
232232
nrx, ncx = x.shape
233233
nry, ncy = y.shape

0 commit comments

Comments
 (0)