tags:

views:

33

answers:

1

How do you do a line plot of a matrix such as A=rand(5) without using surf?

A: 

If you want to plot every column separately in a 2D plot, you just write

plot(A)

If you want to make a 3D plot with lines, you could write:

[xx,yy] = ndgrid(1:6,1:5);
A = [A;NaN(1,size(A,2))]; %# add NaNs so that the lines will be plotted separately
plot3(xx(:),yy(:),A(:)) %# use plot3(xx(:),yy(:),A(:),'.') if you want to plot dots instead of lines.
Jonas

related questions