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
 highlight data points in graphs simultaneously
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Taddy

Germany
6 Posts

Posted - 02/06/2018 :  04:51:06 AM  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:
Hi there, I am new to this forum, so please apologize if I cannot clearly express my problem (and I hope that this is the right address).
In one folder I have several graphs, all plotted from data from the same worksheet (x-y-plots, dendrograms…). What I need is to mark (”highlight”) a range of data points simultaneously in these different plots: I have a large number of data points (observations), which cluster differently in different plots. I need a method to highlight certain observations in one plot, to see where these points lie in a different plot. Additionally, I need to do that in a dendrogram: I want to highlight a cluster in the dendrogram and see where these specific observations plot in any x-y-plot.
I tried with “Selection on all plots”, “Mask”, and the “Markers”. Only masking worked (although only in the x-y-plots, not in the dendrogram). However, I do not need masking the points, but just highlight them. And I would like to select the highlighted observations from the dendrogram. I somehow cannot imagine that this is not possible. Can you help me? By the way: I am not fit in any way in programming.


Taddy

Hideo Fujii

USA
1582 Posts

Posted - 02/06/2018 :  11:05:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

For the regular XY plot, you can create an extra color control data column, and put the index color
(1=Black, 2=Red, 3=Green,... See https://www.originlab.com/doc/LabTalk/ref/List-of-Colors) to the
column. (You can enter e.g.1 to F(x)= header row for the default color), then you can set this column
for the color indexing in the Symbol tab in the Plot Details dialog. You can change the color number of
your desired data point, and data points in the (color indexed) plots changes the color of the points
accordingly. (https://www.originlab.com/doc/Origin-Help/PlotColor-DatasetControl)

Regarding the color control in dendrogram, I cannot think of good solution. (e.g. Axis tick labels
currently cannot be controlled by indexing.)

--Hideo Fujii
OriginLab
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/06/2018 :  5:19:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

I probably need more information about what you want to do exactly....

In my previous post, I thought that when you specify some data in worksheet, you want to
highlight their all data points in all graphs are highlighted. But rather than that, do you want
to select some data point in one graph, then the same data points in other graphs
should be highlighted, too?
Or, further than that, not only for the same data points, but also highlighting data points of
other dataset which shares the same X value? Or, I misunderstood completely differently?

Anyway, of cource, you don't want to use masking just for coloring the data points because
it may affect the analysis or statistics of that data. Not a good idea.
To overcome the point, though having the graphic interactivity, the following script converts
the masked data points (of the active dataset) in a graph to an extra column which indexes
the symbol colors:
//////// Convert Masking to Indexing ////////////
color_default=4;   //BLUE
color_highlight=5; //CYAN
gn$=%H;             //Graph window name
range rd=%c;        //Range of active dataset
bn$=Token(%C, 1, '_')$; //Original workbook name
window -a %(bn$);   //Activate the source workbook
worksheet -a 1;     //Add one column
ic=wks.ncols;       //Column# of index column
range ri=wcol(ic);  //Range of index column
window -a %(gn$);   //Reactivate the graph
nr=rd.getSize();    //Number of rows
for(ii=1; ii<=nr; ii++) {
  if(rd<ii>==1) {  //If point is masked: 
    ri[ii]=color_highlight;  //Set the highlight color
    rd<ii>=0;                //Unmask the point
  }
  else ri[ii]=color_default; //Set the default color
}
set rd -csen ri;  //Make the plot symbol color indexed
//Note: If the plots are grouped, you have to ungroup or set them independent. 
///////////////////////////////////////////////////////
--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 02/06/2018 5:53:06 PM
Go to Top of Page

Taddy

Germany
6 Posts

Posted - 02/07/2018 :  03:23:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo, thank you for your fast reply!
My problem is exactly what you wrote in your second post: I want to select certain data points in one graph, then the same data points in other graphs should be highlighted as well.
Imagine some x-y-plots with about 3000 data points, which cluster differently in different x-y-plots. When I highlight one cluster in one plot, I would like to see where these data points are in the other x-y-plot(s). Ideally I would like to combine that with the dendrogram from the cluster analyses: I would like to see if a certain cluster in the dendrogram corresponds to any cluster in an x-y-plot.
You are correct that I do not want to use masking for coloring the data points, for exactly the reason you mentioned.
Do you have an idea how I could solve that?
Taddy

Taddy
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/09/2018 :  2:43:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

For the first part, I will suggest to develop an app to our developers. Meanwhile you can use the masking
tool (lasso for points, double-click for single point), then run the above script. All data points in all plots
which have index color symbols pointed to the created column would be highlighted.

For the second part, I have created the following script which also creates a new column for indexing from
the double-clicked data ID's in the dendrogram. Again, all plots with indexed symbol colors would be highlighted.
You can run as many times as you like so that different groups of points are indexed differently.
Could you please try it?

////////// Interactive Data Indexer from Dendrogram ///////////////////////
color_default=1;   //BLACK
color_highlight=2; //RED
maxpts=150;        //max# of points
if(exist(%H)!=3) {
  type -b Error: The active window is not a graph(dendrogram).;
  Return;
}
getN (Datasheet# in workbook) idatasheet;
type -b Double-click (or select and press ENTER) the 'foot' on X axis of each desired data point. When you finish selecting points (max:$(maxpts)), press "Refresh" tool button.;
cname$=%C;                   //Dataset of the active plot
if(find(cname$,"@")<=0) lname$="1"; else lname$=token(cname$,2,'@')$;  //Active sheet#
bname$=token(cname$,1,'_')$; //Active book
getpts maxpts;               //Collect data points interactively
Queue {
  dotool 0;                  //Return to arrow tool
  type -b You have selected $(getpts.count) points. Indexing process now starts!;
  range rp=[%(bname$)]%(lname$)!1, rx=[%(bname$)]%(lname$)!2, ry=[%(bname$)]%(lname$)!3;
  nc=getpts.count;    //Number of points
  window -a %(bname$);
  page.active=idatasheet;
  worksheet -a 1;     //Add one column
  ic=wks.ncols;       //Column# of index column
  range ri=wcol(ic);  //Range of index column
  range r1=col(1);
  nr=r1.getSize();    //Number of source data rows
  for(ii=1; ii<=nr; ii++) {      //Loop over source data
    for(jj=1; jj<=nc; jj++) {    //Loop over collected points
      if(rp[$(_xpos[jj])]==ii) {
        if(ry[$(_indx[jj])]!=0) 
          type -a Warning: You selected a point not on the X axis. (X,Y):($(rx[_indx[jj]],.3), $(ry[_indx[jj]],.3));
        else ri[ii]=color_highlight;  //Set the highlight color
        Break;
      }
      else ri[ii]=color_default;      //Set the default color
    }
  }
}
///////////////////////////////////////////////////////////////////
Here are screenshots in my test:




Hope this tool is useful for you and other users of cluster analysis.

--Hideo Fujii
Originlab

Edited by - Hideo Fujii on 02/16/2018 11:05:40 AM
Go to Top of Page

Taddy

Germany
6 Posts

Posted - 02/14/2018 :  11:59:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo!

Yes, an app would be great for that!

I have used the first script, and it worked, so thank you for that (although an app would be much more comfortable ...)

Regarding the second script for indexing via selecting the data in the dendrogram: I already fail at the beginning of your instruction. I somehow do not manage to select the "foot" of the x-axis (because then the normal x-axis window opens), and I cannot select single data by clicking on their IDs under the x-axis. They are always all selected, as soon as I click on one, and then, again, the x-axis windows opens (na matter where I am clicking in the x-axis' vicinity). What am I doing qrong?

Thanks a lot for your help!

Taddy
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/15/2018 :  09:57:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

What the X Axis dialog appeared means the mouse cursor is not in the DataReader mode.
The cursor should be changed to DataReader which icon is like a square with 4 ticks on
the edges, from the Arrow pointer cursor. To make sure, could you please try the following
command when the dendrogram window is active:
getpts 3;
By this command, you should see that the cursor shape changes to the DataReader icon,
and you can get 3 points on the X axis.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 02/15/2018 10:04:39 AM
Go to Top of Page

Taddy

Germany
6 Posts

Posted - 02/15/2018 :  12:09:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo!

Several problems:
Via the getpts command I somehow manage to mark points. It does not work using the data reader via its icon on the GUI alone. Furthermore, when I enlargen the dendrogram window to fill the screen, the marks disappear. Is it supposed to be like this? Sorry for my questions but I do not have the slightest idea about programming.
After marking the points, When I enter the script you suggested a windows appears saying

"Double-click (or delect and press ENTER) the 'foot' on X axis of each desired data point. When you finish selecting points (max:150), press "Refresh" tool button.

When I press ok the following line appears in the script window:
token(cname$,2,'@')$: str expression error
When I go back to the dendrogram window and press “refresh” my selected points disappear and the following window pops up:

You have selected = points. Indexing process now starts!

After pressing okay, another line of
token(cname$,2,'@')$: str expression error
appears.
And my marked points are gone.

Help!



Taddy
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/15/2018 :  2:49:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hi Taddy,

Just FYI, data highlight is a key Origin 2019 feature, as in our current development plan, so we maybe able to provide you with an Alpha version a few month down the road.

CP

Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/15/2018 :  4:32:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

Sorry, it was my mistake. Could you please replace the 10th line of the code with the following line as
shown in GREEN in my previous post:
if(find(cname$,"@")<=0) lname$="1"; else lname$=token(cname$,2,'@')$;  //Active sheet#
Regarding the problem of enlarged graph, I have no good idea - maybe you can make the graph into the
full-screen mode beforehand; then you can pan/zoom by pressing "A" key (with mouse-wheel) to show
the region of your interest?

Hope this time the snippet works.

--Hideo Fujii
OriginLab
Go to Top of Page

Taddy

Germany
6 Posts

Posted - 02/16/2018 :  06:35:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo!

Thank you for your suppotz!

I tried the script with your correction and so far at least no error warning appears.

I was able to mark the points in the dendrogram, then the window which appeared next informed me that I selected X points and that indexing starts.

But unfortunately then nothing happens; from your post I expected a new column in the worksheet with a colour index. This did not happen, my workesheet looks unaffected, no new column is added.

Tatjana

Taddy
Go to Top of Page

Taddy

Germany
6 Posts

Posted - 02/16/2018 :  06:47:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CP,

thank you for the information. Although it sounds pretty trivial a tool like that is extremely useful for data evaluation. In the beginning I could not even believe that this is not possible in a program like Origin. It would also be of great help if the points would not only be highlightes in the different plots simultaneously, but also in the worksheet (as e.g. it is possible in GIS programs or JMP).
However, do I understand correctly that the tool will only be available for Origin 19 users? It will not be available also for other Origin versions as an app?




Taddy
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/16/2018 :  11:22:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

I see the problem. The problem is that the dendrogram doesn't know which sheet
the original data came from!
I guess that your data's worksheet is not the first, isn't it?
It is very awkward to enter the sheet# manually, but I don't so far get a good solution.
Could you please change two lines in BLUE in my previous post? I will continue to seek
a better solution.

--Hideo Fujii
OriginLab
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/16/2018 :  7:17:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Taddy
However, do I understand correctly that the tool will only be available for Origin 19 users? It will not be available also for other Origin versions as an app?



Hi Taddy,

Historically, Origin came from Physics, Chemistry and Test and Measurement world, and only in recent years we have added more categorical data support, so multivariate data handling is one area we have been putting more effort into.

This feature to highlight data points across graphs (and sure, worksheet) involves very low level changes in Origin, so it cannot be an App. Origin2019 will be needed, and we should have a beta version sometime in the summer.

CP

Go to Top of Page

snowli

USA
1386 Posts

Posted - 06/13/2018 :  5:38:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Taddy,

Thank you for requesting this feature. We feel it's a nice addition to our Origin.

We have released Origin 2019beta1 with this feature last Friday. I sent an email to you about this.

Could you check the email and let us know if you are willing to try it in Origin 2019 beta1.

Sincerely, Snow Li
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