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 for Programming
 Forum for Python
 Inquiry on Adding an Inset Graph in OriginPro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

edu404

Brazil
6 Posts

Posted - 06/03/2024 :  07:52:06 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver 2024 Academic.
Operating System: Windows 10


Hello OriginLab community,

I'm seeking assistance on how to add an inset graph within a main graph using OriginPro. I've been exploring various methods to achieve this, including utilizing Python scripting with the originpro library.

However, I've encountered challenges in positioning the inset graph correctly within the main graph. I've attempted to use different approaches, such as directly setting the position and size of the inset graph or utilizing specific functions like lt_execute, but haven't been successful so far.

Could anyone provide guidance or best practices on how to effectively add an inset graph within a main graph in OriginPro?

Any insights or examples demonstrating the process would be greatly appreciated.

Thank you for your assistance.

Best regards,
[Edu]

Edu

Edited by - edu404 on 06/03/2024 07:53:37 AM

YimingChen

1607 Posts

Posted - 06/03/2024 :  11:43:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The inset graph is inherently a second layer. Suppose you have two layers on one graph, and set the second layer as the inset of the first layer.
You can link the second layer to the first layer, set the layer size/position unit to be % of the first layer. This allows you to accurately control the size of the inset layer. Here is a sample LabTalk script:

page.active=2; // activate the second layer
layer.link=1;  // link the second layer to the first layer
layer.unit=7;  // set the layer position/size unit to be % of linked layer 
layer.left=0;  
layer.top = 0;
layer.width = 25;
layer.height = 20;


The Python script example

import originpro as op
gp = op.find_graph()
gl = gp[1]
gl.set_int("link",1)
gl.set_int("unit",7)
gl.set_int("left", 0)
gl.set_int("top",0)
gl.set_int("width",25)
gl.set_int("height",20)


James
Go to Top of Page

edu404

Brazil
6 Posts

Posted - 06/04/2024 :  09:08:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

The inset graph is inherently a second layer. Suppose you have two layers on one graph, and set the second layer as the inset of the first layer.
You can link the second layer to the first layer, set the layer size/position unit to be % of the first layer. This allows you to accurately control the size of the inset layer. Here is a sample LabTalk script:

page.active=2; // activate the second layer
layer.link=1;  // link the second layer to the first layer
layer.unit=7;  // set the layer position/size unit to be % of linked layer 
layer.left=0;  
layer.top = 0;
layer.width = 25;
layer.height = 20;


The Python script example

import originpro as op
gp = op.find_graph()
gl = gp[1]
gl.set_int("link",1)
gl.set_int("unit",7)
gl.set_int("left", 0)
gl.set_int("top",0)
gl.set_int("width",25)
gl.set_int("height",20)


James



It Works!! Thanks!!

Edu
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