@@ -895,7 +895,7 @@ def gcf():
895895def gci ():
896896 """
897897 get the current ScalarMappable instance (image or patch
898- collection), or None if no images or patch collecitons have been
898+ collection), or None if no images or patch collections have been
899899 defined. The commands imshow and figimage create images
900900 instances, and the commands pcolor and scatter create patch
901901 collection instances
@@ -1381,83 +1381,7 @@ def switch_backend(newbackend):
13811381 reload (backends )
13821382 from backends import new_figure_manager , draw_if_interactive , show
13831383
1384- def matshow (* args ,** kw ):
1385- """Display an array as a matrix in a new figure window.
1386-
1387- The origin is set at the upper left hand corner and rows (first dimension
1388- of the array) are displayed horizontally. The aspect ratio of the figure
1389- window is that of the array, as long as it is possible to fit it within
1390- your screen with no stretching. If the window dimensions can't accomodate
1391- this (extremely tall/wide arrays), some stretching will inevitably occur.
1392-
1393- Tick labels for the xaxis are placed on top by default.
1394-
1395- matshow() calls imshow() with args and **kwargs, but by default it sets
1396- interpolation='nearest' (unless you override it). All other arguments and
1397- keywords are passed to imshow(), so see its docstring for further details.
1398-
1399- Special keyword arguments which are NOT passed to imshow():
1400-
1401- - fignum(None): by default, matshow() creates a new figure window with
1402- automatic numbering. If fignum is given as an integer, the created
1403- figure will use this figure number. Because of how matshow() tries to
1404- set the figure aspect ratio to be the one of the array, if you provide
1405- the number of an already existing figure, strange things may happen.
1406-
1407- - returnall(False): by default, the return value is a figure instance.
1408- With 'returnall=True', a (figure, axes, image) tuple is returned.
1409-
1410-
1411- Example usage:
1412-
1413- def samplemat(dims):
1414- aa = zeros(dims)
1415- for i in range(min(dims)):
1416- aa[i,i] = i
1417- return aa
1418-
1419- dimlist = [(12,12),(128,64),(64,512),(2048,256)]
1420-
1421- for d in dimlist:
1422- fig, ax, im = matshow(samplemat(d))
1423- show()
1424- """
1425-
1426- # Preprocess args for our purposes
1427- arr = asarray (args [0 ])
1428- # Extract unique keywords we can't pass to imshow
1429- kw = kw .copy ()
1430- fignum = popd (kw ,'fignum' ,None )
1431- retall = popd (kw ,'returnall' ,False )
1432-
1433- # Extract actual aspect ratio of array and make appropriately sized figure
1434- w ,h = figaspect (arr )
1435- fig = figure (fignum ,figsize = (w ,h ))
1436- ax = fig .add_axes ([0.15 , 0.09 , 0.775 , 0.775 ])
1437-
1438- ax .xaxis .tick_top ()
1439- ax .title .set_y (1.05 ) # raise it up a bit for tick top
1440- kw ['aspect' ] = 'auto'
1441- # imshow call: use 'lower' origin (we'll flip axes later)
1442- kw ['origin' ] = 'lower'
1443- # Unless overridden, don't interpolate
1444- kw .setdefault ('interpolation' ,'nearest' )
1445- # All other keywords go through to imshow.
1446- im = ax .imshow (* args ,** kw )
1447- gci ._current = im
1448-
1449- # set the x and y lim to equal the matrix dims
1450- nr ,nc = arr .shape [:2 ]
1451- ax .set_xlim ((0 ,nc ))
1452- ax .set_ylim ((nr ,0 ))
1453-
1454- draw_if_interactive ()
1455- if retall :
1456- return fig , ax , im
1457- else :
1458- return fig
1459-
1460- def matshow1 (A , ** kw ):
1384+ def matshow (A , fignum = None , ** kw ):
14611385 """Display an array as a matrix in a new figure window.
14621386
14631387 The origin is set at the upper left hand corner and rows (first dimension
@@ -1467,18 +1391,17 @@ def matshow1(A, **kw):
14671391
14681392 Tick labels for the xaxis are placed on top.
14691393
1470- Special keyword arguments which are NOT passed to imshow():
1394+ With one exception, keyword arguments are passed to
1395+ imshow().
1396+
1397+ Special keyword argument which is NOT passed to imshow():
14711398
14721399 - fignum(None): by default, matshow() creates a new figure window with
14731400 automatic numbering. If fignum is given as an integer, the created
14741401 figure will use this figure number. Because of how matshow() tries to
14751402 set the figure aspect ratio to be the one of the array, if you provide
14761403 the number of an already existing figure, strange things may happen.
14771404
1478- - returnall(False): by default, the return value is a figure instance.
1479- With 'returnall=True', a (figure, axes, image) tuple is returned.
1480-
1481-
14821405 Example usage:
14831406
14841407 def samplemat(dims):
@@ -1490,14 +1413,12 @@ def samplemat(dims):
14901413 dimlist = [(12,12),(128,64),(64,512),(2048,256)]
14911414
14921415 for d in dimlist:
1493- fig, ax, im = matshow(samplemat(d), returnall=True )
1416+ im = matshow(samplemat(d))
14941417 show()
14951418 """
14961419
1497- # Extract unique keywords we can't pass to imshow
1498- kw = kw .copy ()
1499- fignum = kw .pop ('fignum' , None )
1500- retall = kw .pop ('returnall' , False )
1420+ #kw = kw.copy()
1421+ #fignum = kw.pop('fignum', None)
15011422
15021423 # Extract actual aspect ratio of array and make appropriately sized figure
15031424 fig = figure (fignum , figsize = figaspect (A ))
@@ -1507,11 +1428,7 @@ def samplemat(dims):
15071428 gci ._current = im
15081429
15091430 draw_if_interactive ()
1510- if retall :
1511- return fig , ax , im
1512- else :
1513- return fig
1514-
1431+ return im
15151432
15161433def setp (* args , ** kwargs ):
15171434 ret = _setp (* args , ** kwargs )
0 commit comments