From: Dominique O. <Dom...@po...> - 2004-11-12 15:25:50
|
> To: Nils Wagner <nw...@me...> > Cc: SciPy Users List <sci...@sc...>, > mat...@li... > Subject: Re: [Matplotlib-users] Visualizing Sparsity Pattern of matrices > From: John Hunter <jdh...@ac...> > Date: Thu, 11 Nov 2004 09:16:03 -0600 > > >>>>>>"Nils" == Nils Wagner <nw...@me...> writes: > > > Nils> Hi all, Structure plots provide a quick visual check on the > Nils> sparsity pattern of the matrix. A structure plot is a > Nils> rectangular array of dots; a dot is black if the > Nils> corresponding matrix element is nonzero otherwise it is > Nils> white. > > Nils> Is it possible to generate such plots with scipy or should > Nils> we switch over to matplotlib ? > > Here's another implementation that uses images - likely to be much > faster for very large matrices. Hi, As part of a programming environment for optimization in Python (soon to be released hopefully), I use Matplotlib for the graphics. I created several functions imitating Matlab's spy() using scatter(). My sparse matrices are represented in linked-list, compressed column or compressed row storage using the PySparse implementation http://people.web.psi.ch/geus/pyfemax/pysparse.html Using scatter, I can plot the sparsity pattern of matrices with several thousands of lines and columns in a blink on my 1.7GHz P4 laptop. Using color maps, you can even color your dots according to the magnitude of the element they represent (a 2-dimensional "city plot" of a matrix). Dominique |