Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Connecting the Dots in a Scatter plot

404 views
Skip to first unread message

Arneh Babakhani

unread,
Dec 20, 2006, 11:14:54 AM12/20/06
to
Hello,

I have a set of coordinates, that I can scatter plot in 2D, thus
creating a set of points (or "nodes") in a plane.

In MATLAB, is there a way that I can randomly connect lines between
these nodes, with the rule that if the lines should intersect, they
can only intersect at a node?

...another way of asking this question. . ..

I know you can generate a plot, but that usually means connecting
points in some coherent manner (data point 1 connects to data point
2, to then 3, etc. etc). Is there a way have point 1 connect to
point 10, then point 10 back to point 2, then to point 5, etc etc?

daniel_nor...@hotmail.com

unread,
Dec 20, 2006, 11:25:18 AM12/20/06
to
Arneh Babakhani skrev:

Can't you just reorder the input to plot?

So instead of

plot(x,y)

do

r=randperm(10); % the order you wish to plot in
plot(x(r),y(r));

Daniel

Arneh Babakhani

unread,
Dec 20, 2006, 1:57:10 PM12/20/06
to
yeah, that does seem to work, thanks, I'll go from there,

Arneh

Roger Stafford

unread,
Dec 20, 2006, 3:27:08 PM12/20/06
to
In article <ef491...@webcrossing.raydaftYaTP>, "Arneh Babakhani"
<abab...@mccammon.ucsd.edu> wrote:

----------------------
My understanding is that matlab's 'delaunay' function will give you a
triangulation for an arbitrary set of points in 2D. The sides of these
triangles sound like what you are asking for in your first paragraph,
since they connect the points and don't cross each other. Note that there
is nothing random about this procedure. Each set of points has a unique
delaunay triangulation.

However, in reference to your second paragraph, producing a single
sequence of connected points for 'plot' with non-intersecting connecting
line segments might be a more difficult problem. Random sequencing has a
high probability of producing crossing segments. If you reorder the
points in accordance with their x-coordinates, or y-coordinates, or in
fact the distance orthogonal to any particular fixed line, and connect
successive points in this ordering, this would solve your problem but the
resulting jagged appearance might not be to your liking.

I hope I have understood the question your are asking.

Roger Stafford

ARNEH BABAKHANI

unread,
Dec 20, 2006, 4:17:05 PM12/20/06
to
Hi Roger, yes, you did understand my question, thanks for the input,
I'll check out the delauney function.

Arneh

0 new messages