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

조회 수: 4 (최근 30일)
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.

채택된 답변

Teja Muppirala
Teja Muppirala 2013년 9월 20일
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-')

추가 답변 (1개)

Chris
Chris 2013년 9월 20일
Oh wow. The transpose worked perfectly:
Thanks.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by