To: Nils Wagner <nwagner@...56...>
Cc: SciPy Users List <scipy-user@...29...>,
  matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Visualizing Sparsity Pattern of matrices
From: John Hunter <jdhunter@...4...>
Date: Thu, 11 Nov 2004 09:16:03 -0600

"Nils" == Nils Wagner <nwagner@...56...> writes:

    > Hi all, Structure plots provide a quick visual check on the
    > sparsity pattern of the matrix. A structure plot is a
    > rectangular array of dots; a dot is black if the
    > corresponding matrix element is nonzero otherwise it is
    > white.

    > Is it possible to generate such plots with scipy or should
    > 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
  Telefonbuch & E-Mail | Paul Scherrer Institut (PSI)

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