[SciPy-user] Problem with plot
John Hunter
jdh2358 at gmail.com
Tue Mar 11 09:37:57 EDT 2008
On Tue, Mar 11, 2008 at 3:50 AM, Michael Nandris
<mnandris at btinternet.com> wrote:
> from numpy import matrix
> from scipy.linalg import inv, det, eig
> from pylab import plot, show
The plotting function spy should help (plot is designed to plot line
data). See also imshow for 2D array plotting
def spy(self, Z, precision=None, marker=None, markersize=None,
aspect='equal', **kwargs):
"""
spy(Z) plots the sparsity pattern of the 2-D array Z
If precision is None, any non-zero value will be plotted;
else, values of absolute(Z)>precision will be plotted.
The array will be plotted as it would be printed, with
the first index (row) increasing down and the second
index (column) increasing to the right.
By default aspect is 'equal' so that each array element
occupies a square space; set the aspect kwarg to 'auto'
to allow the plot to fill the plot box, or to any scalar
number to specify the aspect ratio of an array element
directly.
Two plotting styles are available: image or marker. Both
are available for full arrays, but only the marker style
works for scipy.sparse.spmatrix instances.
If marker and markersize are None, an image will be
returned and any remaining kwargs are passed to imshow;
else, a Line2D object will be returned with the value
of marker determining the marker type, and any remaining
kwargs passed to the axes plot method.
If marker and markersize are None, useful kwargs include:
cmap
alpha
See documentation for imshow() for details.
For controlling colors, e.g. cyan background and red marks, use:
cmap = mcolors.ListedColormap(['c','r'])
If marker or markersize is not None, useful kwargs include:
marker
markersize
color
See documentation for plot() for details.
Useful values for marker include:
's' square (default)
'o' circle
'.' point
',' pixel
"""
More information about the SciPy-User
mailing list