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
 Labels in line plot are overlapping

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
JoD Posted - 07/13/2018 : 09:39:52 AM
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

3   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 07/16/2018 : 4:27:32 PM
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

JoD Posted - 07/16/2018 : 03:06:49 AM
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?
Hideo Fujii Posted - 07/13/2018 : 4:34:59 PM
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

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