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
 Labels in line plot are overlapping
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JoD

Germany
8 Posts

Posted - 07/13/2018 :  09:39:52 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I need to label data points in a line plot. In "Plot Details - Plot Properties" in the tab "Label" I checked "Enable" and chose all labels two columns to the right of Y values by the format string %(wcol(n+2)[i]$).
However, even though I checked "Auto Reposition to Avoid Overlapping" the labels are still overlapping (last two labels "g" - see attached screenshots).

Thanks for your suggestions!


Origin Ver. and Service Release: OriginPro 2017 b9.4.0.220
Operating System: Windows 10


Edited by - JoD on 07/13/2018 09:45:42 AM

Hideo Fujii

USA
1582 Posts

Posted - 07/13/2018 :  4:34:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi JoD,

The "Auto Reposition to Avoid Overlapping" option has the effect on the points which belong to the same plot.
You can slowly click a label twice to be selected as a "special point", then you can move this specific label.

Hope this helps.

--Hideo Fujii
OriginLab
Go to Top of Page

JoD

Germany
8 Posts

Posted - 07/16/2018 :  03:06:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your answer!

Since this problem occurs quite in many of my graphs an automatic solution would be ideal. Isn't there any way to solve this automatically with Origin?
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 07/16/2018 :  4:27:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi JoD,

Checking the overlapped point within the current plot may be a reasonable design. (Imagine a situation
such that you add a plot, then ALL data labels of current plots may have to repositioned...)

Though checking is static, the following script may help you...
//////////////////////////////////////////////////////////////
//Run this script on a graph without data labels
//
if(exist(%H)!=3) { type -b Active window is not a graph.; Return; }
gname$=%H;      //Graph name
nout=0;         //Total #data points 
window -t wks;  //Make a worksheet
worksheet -a 1; //Add a col to have c3 columns
range rrx=col(1), rry=col(2), rrL=col(3); //Range of rach column
window -ch 1;           //Hide the worksheet
window -a %(gname$);    //Reactivate the graph
doc -e DY {             //Loop over each plot in the graph
  range rpy=%C;         //Y dataset of the plot
  dataset rpx=xof(rpy); //X dataset of the plot
  string colname$ = "";
  getn (Label Column for %C is:) colname$:@BBColumn (Choose Label Column);  //Select label dataset
  range rpL=%(colname$); //Label dataset
  nrpy=rpy.getSize();     //# of rows of the plot
  for(jj=1; jj<=nrpy; jj++) { //Loop over plot dataset
    nout++;              //Index of the point
    rry[nout]=rpy[jj];   //Y coordinate of the point
    rrx[nout]=rpx[jj];   //X coordinate of the point
    rrL[nout]$=rpL[jj]$; //Label of the point
  }
}
layer -i201 rry;  //Add a scatter plot to the graph
set rry -z 0;     //Make the scatter invisible (symbol size 0)
set rry -q 1;     //Set the data label ON
set rry -qm 8;    //Label dataset is col(C)
//
//You should turn ON "Auto Reposition to Avoid Overlapping" manually.
//////////////////////////////////////////////////////////////
First create a graph without labels, and once you run this script, it creates an invisible scatter plot
with all data points in a temporary worksheet. At this moment, as it seems LabTalk cannot control the
"Auto Reposition to Avoid Overlapping" property, after running this you have to turn on this option
manually by yourself for the generated hidden scatter plot. You should be able to see the labels in effect.

You can modify this whatsoever you need.

--Hideo Fujii
OriginLab


Edited by - Hideo Fujii on 07/16/2018 5:39:10 PM
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