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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 plotting tracks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ifsmithy

USA
Posts

Posted - 08/10/2012 :  3:02:41 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:7
8.6

Hi - I'd like to be able to plot tracking data from multiple objects. The data I have is 4 columns. The first column identifies the object number (1 through many thousands), second and third column are an xy position and the fourth column is the speed of the object at those particular xy positions.

I can plot all the individual data along with speed using the plot/symbol/color mapped (not plotting object number) but I'd like to be able to join the dots so to speak so that all the objects identified as a '1' are joined together via a line, all the 2's are joined together etc etc.

Many Thanks in advance!

Drbobshepherd

USA
Posts

Posted - 08/13/2012 :  12:49:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. I recommend you process your data using a LabTalk script. Get your program to process one object the way you want, then use the loop command to apply your process to all objects.

2. Sort your data according to object. Copy your 4-column format to multiple spreadsheets and separate your data into the appropriate spreadsheets according to object number using the Wextract X-function.

3. Create a line- or line/symbol- plot for one of the data sheets. Get it how your want and save as a template for the rest of your plots.

4. Plot several data sheets (I doubt you will want to see all of the thousands of objects plotted at once-- too busy).

5. Merge the open graphs into one graph using the Merge Graphs button.

These are just suggestions off the top of my head. There are probably many other ways to do this. I hope this helps.

DrBobShepherd
Go to Top of Page

greg

USA
1378 Posts

Posted - 08/13/2012 :  3:13:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You could try unstacking your data..
Make sure your second column is set to X Plot designation
Select your second, third and fourth column
Choose Worksheet : Unstack
Choose Column 1 as your Group Column(s)
Click OK

You should now have a worksheet with all your data unstacked by 'object'.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/13/2012 :  4:46:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In addition, one handy way is that you can insert a missing data row between groups -
as Origin disconnects the missing data point in default. Here is the procedure:

1) Convert your worksheet to a worksheet with "separator" rows using the script below.
2) Make a color mapped scatter as you did.
3) Change the plot type to Line+Symbol by pressing its button in the 2D Graph toolbar.
Please see the attached screenshot.



The sample script is as follows:

//////////////////////////////////////
nc=wks.nCols;
nr=wks.maxRows;
wks1$=%H;
window -t wks;
wks2$=%H;
worksheet -a 2;
for(kk=1; kk<=nc; kk++) {
  range ri=[wks1$]1!wcol(kk); 
  range ro=[wks2$]1!wcol(kk);
  ro[L]$=ri[L]$;  //copy long name
}
wks.col1.type=2;  //Set 1st col as Disregard
wks.col2.type=4;  //Set 2nd col as X
prev=-1;
jj=1;  //pointer for output
for(ii=1; ii<=nr; ii++) {
  range r1=[wks1$]1!col(1); 
  if(ii>1 && r1[ii]!=prev) {
    for(kk=1; kk<=nc; kk++) {
      range ro=[wks2$]1!wcol(kk); 
      ro[jj]=1/0;  //insert missing value
    }
    prev=r1[ii];
    jj++;
  }
  for(kk=1; kk<=nc; kk++) {
    range ri=[wks1$]1!wcol(kk); 
    range ro=[wks2$]1!wcol(kk);
    ro[jj]=ri[ii];  //copy a cell
  };
  prev=r1[ii];
  jj++;
}
//////////////////////////////////////

Hope this helps.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 08/13/2012 4:48:05 PM
Go to Top of Page

Sam Fang

291 Posts

Posted - 08/13/2012 :  11:54:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use plotgroup X-Function to plot.
1. Plot a Line+Symbol graph, and choose speed column as color map column for line and symbol. Save it as a graph template.
2. In the command window, run
plotgroup -d;
choose xy columns as input, the objects column as Column for Data Group, and the saved template as Graph Template.
3. Double click on the graph, in the Plot Details dialog, choose the first plot, click Group tab, and select Independent as Edit Mode.

Sam
OriginLab Technical Services

Edited by - Sam Fang on 08/13/2012 11:56:49 PM
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/14/2012 :  3:18:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
P.S.

Sam's "plotgroup" x-function shines nicely in most cases with reasonable number of
plot groups. If there are thousands like your case, you can still try my method.
Also, if you want to make vector plots to indicate the direction, you can modify my script like below.



Hope this suggestion helps people someway who visit this post.

//////////////////////////////////////////////////
nc=wks.nCols;
nr=wks.maxRows;
wks1$=%H;
window -t wks;
wks2$=%H;
worksheet -a 4;
//Set Long Names
range ri=[wks1$]1!col(1); range ro=[wks2$]1!col(1); ro[L]$=ri[L]$;
range ro=[wks2$]1!col(2); ro[L]$="X1";
range ro=[wks2$]1!col(3); ro[L]$="Y1";
range ro=[wks2$]1!col(4); ro[L]$="X2";
range ro=[wks2$]1!col(5); ro[L]$="Y2";
range ri=[wks1$]1!col(4); range ro=[wks2$]1!col(6); ro[L]$=ri[L]$;
wks.col1.type=2;  //Set 1st col as Disregard
wks.col2.type=4;  //Set 2nd col as X
wks.col4.type=4;  //Set 4th col as X
curr=-1;
for(ii=1; ii<nr; ii++) {
  range r1=[wks1$]1!col(1);
  curr=r1[ii];
  if(r1[ii+1]!=curr) {
    for(kk=1; kk<=nc+2; kk++) {
      range ro=[wks2$]1!wcol(kk); 
      ro[ii]=1/0;  //insert missing value
    }
  }
  else {  //copy cells
    range ri=[wks1$]1!col(1); range ro=[wks2$]1!col(1); ro[ii]=ri[ii];
    range ri=[wks1$]1!col(2); range ro=[wks2$]1!col(2); ro[ii]=ri[ii];
    range ri=[wks1$]1!col(3); range ro=[wks2$]1!col(3); ro[ii]=ri[ii];
    range ri=[wks1$]1!col(2); range ro=[wks2$]1!col(4); ro[ii]=ri[ii+1];
    range ri=[wks1$]1!col(3); range ro=[wks2$]1!col(5); ro[ii]=ri[ii+1];
    range ri=[wks1$]1!col(4); range ro=[wks2$]1!col(6); ro[ii]=ri[ii];
  }
}
//////////////////////////////////////////////////
Go to Top of Page

ifsmithy

USA
Posts

Posted - 08/14/2012 :  7:54:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks all for the very helpful tips. I can now accomplish what I need to get done!
Appreciated!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000