help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: turn off the colors in a matrix plot


From: soren
Subject: Re: turn off the colors in a matrix plot
Date: Tue, 15 Apr 2008 15:53:14 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.2-RC1)

Quoting Kamaraju S Kusumanchi <address@hidden>:

I have a matrix, say

octave:94> f=[1 2 3 4; 0 1 2 3; -1 0 1 2]
f =

   1   2   3   4
   0   1   2   3
  -1   0   1   2

and I would like to plot this matrix as a surface using the row index and
column index as the x, y values. That is my points in the 3-D plot would be

(1,1, 1) (1,2,2) (1,3,3) (1,4,4)
(2,1, 0) (2,2,1) (2,3,2) (2,4,3)
(3,1,-1) (3,2,0) (3,3,1) (3,4,2)

Currently I am doing this by

octave:95> NX=3; NY=4; [yy, xx] = meshgrid([1:NY],[1:NX]), f=[1 2 3 4; 0 1 2
3; -1 0 1 2], mesh(xx, yy, f), xlabel("x"), ylabel("y")

Can't you just do:
  mesh (f)
?
If you want to change the colors I think you can just change the colormap. And if you just want to plot point, look at the 'plot3' function.

Søren

This gives me the correct plot as desired. However, the values are plotting
with color coding in them (red to blue). Is there any way to turn off the
colors? Is there any option to remove the lines and just plot the points?

Also, I would appreciate if someone could provide an elegant way to solve
the above problem of plotting the matrix. Right now, my solution looks very
round about way of doing it with all the reordering of x, y coordinates
etc., Any suggestions?

thanks
raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/

_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave






reply via email to

[Prev in Thread] Current Thread [Next in Thread]