Menu

[r3806]: / branches / transforms / examples / spy_demos.py  Maximize  Restore  History

Download this file

24 lines (17 with data), 365 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
Plot the sparsity pattern of arrays
"""
from pylab import figure, show, nx
fig = figure()
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222)
ax3 = fig.add_subplot(223)
ax4 = fig.add_subplot(224)
x = nx.mlab.randn(20,20)
x[5] = 0.
x[:,12] = 0.
ax1.spy(x, markersize=5)
ax2.spy(x, precision=0.1, markersize=5)
ax3.spy(x)
ax4.spy(x, precision=0.1)
show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.