[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2D cluster of 2D matrix in Octave?
From: |
Paul Kienzle |
Subject: |
Re: 2D cluster of 2D matrix in Octave? |
Date: |
Fri, 19 Apr 2002 11:38:00 -0400 |
The clustering algorithms you will have to find/write yourself. Please
include them in octave-forge (http://octave.sf.net).
It is possible to produce plots like that of Matlab's dendrogram in gnuplot:
x=[1 1 2 2; 1.5 1.5 4 4; 3 3 5 5];
y=[0 1 1 0; 1.0 3.0 3 2; 0 2 2 0];
ticlab = [ 13, 11, 21, 8 ];
ticpos = [ 1, 2, 3, 5];
tics = sprintf(' "%g" %g,', [ticlab;ticpos]);
eval(["gset xtics (",tics(2:length(tics)-1),")"]);
axis([0 6 0 4])
plot(x',y',"b;;");
But you will have to reset the axis and tic labels when you are done:
gset xtics autofreq
axis;
You can use imagesc with with appropriate colormap to view a
matrix. E.g.,
r=[linspace(0,1,32)';ones(32,1)];
g=[linspace(0,1,32)';linspace(1,0,32)'];
b=[linspace(1,0,32)';zeros(32,1);];
colormap([r,g,b]);
x = linspace(0,1,300);
imagesc(x(ones(20,1),:));
Using epstk you can produce nice printed plots of images with all the
usual plot annotations.
Hope this helps.
Paul Kienzle
address@hidden
On Thu, Apr 18, 2002 at 06:48:22PM -0500, Mark Wall wrote:
> Hello!
>
> I would love to use Octave for the following 2 tasks, but am unable
> to determine if Octave will work. My primary question- is this
> possible in Octave? Secondary- if yes, how?
>
> We routinely use MatLab with the Statistics Tool Box to manipulate
> and plot a 2 dimensional matrix (m x n) of real numbers. If you
> think of each dimension as an array of vectors (e.g. a collection of
> m vectors (each n-dimensions), we 1) cluster these (and generate a
> dendrogram) for both dimensions as below using a city-block distance
> measure:
>
> original matrix with labels
> ----------------
> W X Y Z
> A 0 1 0 0
> B 0 1 0 1
> C 5 0 0 0
> D 0 0 0 2
> E 5 0 0 0
>
> Clustered matrix
> ----------------
> W Y X Z
> E 5 0 0 0
> C 5 0 0 0
> A 0 0 1 0
> B 0 0 1 1
> D 0 0 0 2
>
> In reality, m and n are between 50 and 1000 so we 2) display these
> matrices as an x-y-color plot for easy visualization. Think of this
> as a square frame with each pixel representing a matrix element. The
> values are represented by a color continuum (dark blue = low values,
> through yellow to red = high values). I can provide a JPEG if
> necessary.
>
> With large matrices, we isolate sub-clusters by creating new matrices
> that are the appropriate slices of the original matrix and then
> repeat steps 1 and 2 on the sub-matrices.
>
>
> Thank you,
>
> Mark Wall
> ---------
> HHMI/UT Southwestern Medical Center
> 5323 Harry Hines Blvd.
> Dallas, Texas 75390-9050
> USA
> 214.648.5050
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------