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
 Centering plot in a Letter size page
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

thitchen

44 Posts

Posted - 07/28/2015 :  04:49:38 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9.0.0 (64 bit)and Service Release (Select Help-->About Origin):
Operating System: Win 7 Pro

Is there a way to quickly center a plot in a Letter size page, both vertically and horizontally?

Thank you.

cdrozdowski111

USA
247 Posts

Posted - 07/28/2015 :  09:42:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

First specify your page size in the Plot Details - Page Properties dialog.

Then run this LabTalk code by opening the Script Window from the Window menu and pasting it into the window. Then select the entire script in the Script Window and click Enter.


// Get Page width & height in inches
double pgCenterX = (page.width / page.resx) / 2;
double pgCenterY = (page.height / page.resy) / 2;

// Get Layer half width and half height in inches
int nOld = Layer.unit;
Layer.unit = 2; // Convert to inches
double layHalfX = Layer.width / 2;
double layHalfY = Layer.height / 2;

// Center Layer horizontally (X)
Layer.left = pgCenterX - layHalfX;

// Center Layer vertically (Y)
Layer.top = pgCenterY - layHalfY;

 // Restore previous Layer unit value
Layer.unit = nOld;


~Chris
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