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 中查找有关 Scatter Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by