How to connect points horizontally and vertically in non-rect grid?

10 Ansichten (letzte 30 Tage)
Hey,
I've been working on a problem and have gotten stuck. I've been trying to make a grid of points of a customized shape. I've got the X and Y points of the grid, but I don't know how to completely connect them in 2 directions.
Here is what I have:
Notice how the lines connect in one direction. I want it such that lines go through the "O's" as well. How do I pull this off?
General code:
-giant X matrix with X coordinate of each point. -giant Y matrix of Y coordinate of each point.
figure plot(X,Y,'-o')
Thanks for any help / advice you can give.

Akzeptierte Antwort

Teja Muppirala
Teja Muppirala am 20 Sep. 2013
Idea 1. Use SURF
[x,y] = ndgrid(0:0.1:2); %Just making random data
x = sin(x).*y;
y = x+y.^2;
figure, surf(x,y,zeros(size(x)),'facecolor','none','marker','o','edgecolor','k');
view(2);
Idea 2. Use PLOT twice, the second time with the matrices transposed.
[x,y] = ndgrid(0:0.1:2);
x = sin(x).*y;
y = x+y.^2;
figure, plot(x,y,'o-')
hold on;
plot(x',y','o-')

Weitere Antworten (1)

Chris
Chris am 20 Sep. 2013
Oh wow. The transpose worked perfectly:
Thanks.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by