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
 Centering plot in a Letter size page

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
thitchen Posted - 07/28/2015 : 04:49:38 AM
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.
1   L A T E S T    R E P L I E S    (Newest First)
cdrozdowski111 Posted - 07/28/2015 : 09:42:08 AM
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

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