[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plot Matrix in Octave
From: |
Søren Hauberg |
Subject: |
Re: Plot Matrix in Octave |
Date: |
Mon, 12 Nov 2007 21:42:07 +0100 |
User-agent: |
Thunderbird 1.5.0.13 (X11/20070824) |
Hi,
I don't know of an easy way to draw the numbers in the matrix. You
can do it with the 'text' function, but the code wouldn't be very
elegant. You can, however, try something like this:
A = [4, 3, 3, 2, 2, 1, 0;
2, 2, 2, 3, 2, 1, 0;
1, 2, 2, 1, 2, 2, 0;
0, 0, 0, 0, 0, 0, 1];
imshow(A+1, jet(5))
hold on
plot([1, 4]-0.25, [1, 2]-0.25, 'k-')
plot([4, 6]-0.25, [2, 3]-0.25, 'k-')
plot([6, 7]-0.25, [3, 4]-0.25, 'k-')
hold off
This gives a plot that is fairly similar to what you want, except the
numbers have been replaced with colored boxes (pixels).
Søren
Bratsch skrev:
Hello everyone. I am new in this forum and I hope that someone can help me :)
I have to visualize the path of the longest common substring in a matrix.
But I don't get it to draw, plot or whatever the matrix containing values.
And the path is also a big problem.
It should look like this picture:
http://www.nabble.com/file/p13710192/alignment5.gif
Is it possible in Octave to plot a matrix f.e. A = [1,2,3,4; 2,3,4,5;
3,4,5,6; 4,5,6,7] with the red path like it is shown in the picture?
And is it possible to mark the matrix with the letters T, A, A, G,.. like it
is done in the picture?
If someone could help me would be perfect. Thanks in advance
Bye