The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Lines connecting all the data

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
wz1416scripps Posted - 02/05/2016 : 2:31:07 PM
Origin Ver. and Service Release (Select Help-->About Origin):Originpro 2015
Operating System:Win8.1

Hi,

I have 63 data points in a scatter plot.Now I want to plot the connecting lines for all the possible pair of data points, i.e. (1953 lines for 1953 patterns of pair). How can I do that?

Thanks,
Chao.



5   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 07/28/2016 : 3:56:20 PM
Hi wz1416scripps,

> I want to plot all the lines connecting data points that have (x, y, z), i.e. connecting dots in 3D space.

You can simply expand the CP's code to 3D such that:
//////////////////////////////////////
if(wks.ncols<6)  wks.ncols=6;
range ax=col(1), ay=col(2), az=col(3); //Source X,Y,Z
range bx=4, by=5, bz=6; //Calculated X,Y,Z to plot
bx.type=4; by.type=1; bz.type=6; //Column designations X, Y, Z
int npts = ax.getsize();
for(ii=1, jj=1; ii<=npts; ii++) {
  for(kk=ii+1; kk<=npts; kk++,jj++) {
    bx[jj] = ax[ii];  by[jj] = ay[ii];  bz[jj] = az[ii];
    jj++;
    bx[jj] = ax[kk];  by[jj] = ay[kk];  bz[jj] = az[kk];
    jj++;
    bx[jj] = 0/0;  by[jj] = 0/0;  bz[jj] = 0/0;
  }
}
//////////////////////////////////////

Then, you can make a 3D Trajectory plot ("Plot> 3D Symbol/Bar/Vector> 3D Trajectory" menu). See the sample below.
(Note: Drop lines are hidden, and similar to the 2D sample, only line segments with distance<0.3 are displayed
by using the same filter. You notice that the distance in the column G has the formula using "distance3D" built-in function.)




I hope this is what you wanted.

--Hideo Fujii
OriginLab
wz1416scripps Posted - 07/27/2016 : 7:01:05 PM
Thanks. It works.

Now I have another problem. I want to plot all the lines connecting datapoints that have (x, y, z), i.e. connecting dots in 3D space.

How can I do that?

Thanks,
Chao.


quote:
Originally posted by Hideo Fujii

Hi wz1416scripps,

> For example, only show the lines with the length in the '0~0.5' range.

You can add an extra column, then using Set Column Values tool, calculate the distance from the
previous XY pair to the current pair: e.g., sqrt((col(3)[i]-col(3)[i+1])^2+(col(4)[i]-col(4)[i+1])^2)
in the sample below.

Then, add a filter to this distance column, and put the condition
to keep only within the desired range or the missing value: e.g., x<0.3 || x==1/0 in the sample below.




Hope this helps.

--Hideo Fujii
OriginLab

Hideo Fujii Posted - 02/19/2016 : 5:55:05 PM
Hi wz1416scripps,

> For example, only show the lines with the length in the '0~0.5' range.

You can add an extra column, then using Set Column Values tool, calculate the distance from the
previous XY pair to the current pair: e.g., sqrt((col(3)[i]-col(3)[i+1])^2+(col(4)[i]-col(4)[i+1])^2)
in the sample below.

Then, add a filter to this distance column, and put the condition
to keep only within the desired range or the missing value: e.g., x<0.3 || x==1/0 in the sample below.




Hope this helps.

--Hideo Fujii
OriginLab
wz1416scripps Posted - 02/19/2016 : 1:25:12 PM
Thanks,It works.
If I want to only show the lines within certain distance range, how can I do that?

For example, only show the lines with the length in the '0~0.5' range.

Thanks,
Chao.

quote:
Originally posted by cpyang

There is no built-in plot type for that, but you can use the following Labtalk code to construct the data to make this plot. The code assume you have XY data in a worksheet, and then two new XY will be generated, and you just select these two column to plot as line-symbol.

//assume col 1, 2 to be source XY data
//add col 3 4 as date to be generated to plot as Line-Symbol
if(wks.ncols<4)
	wks.ncols=4;
range ax = 1;//Source X
range ay = 2;//Source Y
range bx = 3;//Calculated X to plot
range by = 4;//Calculated Y to plot
bx.type=4;//X
by.type=1;//Y
int npts = ax.getsize();
for(int ii = 1, jj=1;ii<=npts;ii++)
{
	for(int kk=ii+1;kk<=npts;kk++, jj++)
	{
		bx[jj] = ax[ii];
		by[jj] = ay[ii];
		jj++;
		bx[jj] = ax[kk];
		by[jj] = ay[kk];
		jj++;
		bx[jj] = 0/0;
		by[jj] = 0/0;
	}
}
	


cpyang Posted - 02/06/2016 : 8:43:41 PM
There is no built-in plot type for that, but you can use the following Labtalk code to construct the data to make this plot. The code assume you have XY data in a worksheet, and then two new XY will be generated, and you just select these two column to plot as line-symbol.

//assume col 1, 2 to be source XY data
//add col 3 4 as date to be generated to plot as Line-Symbol
if(wks.ncols<4)
	wks.ncols=4;
range ax = 1;//Source X
range ay = 2;//Source Y
range bx = 3;//Calculated X to plot
range by = 4;//Calculated Y to plot
bx.type=4;//X
by.type=1;//Y
int npts = ax.getsize();
for(int ii = 1, jj=1;ii<=npts;ii++)
{
	for(int kk=ii+1;kk<=npts;kk++, jj++)
	{
		bx[jj] = ax[ii];
		by[jj] = ay[ii];
		jj++;
		bx[jj] = ax[kk];
		by[jj] = ay[kk];
		jj++;
		bx[jj] = 0/0;
		by[jj] = 0/0;
	}
}
	

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000