I'm using SGPANEL with ODS PDF with orientation=landscape and trying to make a plot that is 10 inches wide.
When I try below code, SGPANEL leaves a lot of space on the right, almost as if it's leaving room for an extra column. How can I make the SGPANEL plot fill the page?
options orientation=landscape nocenter;
ods graphics/reset=all border=off width=10in;
ods listing close;
ods pdf file="%sysfunc(pathname(work))\Foo.pdf" style=pearl notoc ;
title1 "Width of sgplot plot is good" ;
proc sgplot data=sashelp.class ;
scatter x=height y=weight ;
run ;
title1 ;
title1 "Width of sgpanel plot is too narrow" ;
proc sgpanel data=sashelp.class ;
panelby sex/ layout=rowlattice onepanel ;
scatter x=height y=weight ;
run ;
title1 ;
ods _all_ close ;
ods listing ;
My pdf looks like:
I tried making the graph narrower (8in or 9in) in case I was hitting the margins, but no luck.
SGPLOT works fine.
Try specifying both the width and the height on the ODS GRAPHICS statement. By default, the aspect of the graph is maintained when you specify only width or height. Hope this helps!
Try specifying both the width and the height on the ODS GRAPHICS statement. By default, the aspect of the graph is maintained when you specify only width or height. Hope this helps!
Thanks for the thought Dan.
When I try e.g. width=10in height=7in the plot is empty and the log tells me:
Cell height -34 is smaller than the minimum cell height 1. All contents are removed from the layout. Cell height -34 is smaller than the minimum cell height 1. All contents are removed from the layout.
Try using these options on the panelby statement (behind the forward slash):
LAYOUT=panel columns=4 novarname
Koen
@sbxkoenk wrote:
Try using these options on the panelby statement (behind the forward slash):
LAYOUT=panel columns=4 novarnameKoen
That gives a single row with 4 columns, and uses the whole page correctly:
But I want a single column, with two rows. If I use Layout=panel columns=1, I'm back to having an image half the width of the page:
I tried your test program using 10in by 7in and it worked as expected for me. Are there any other options active in your session?
This is what I get with your test program at 10in by 7in:
Thanks @DanH_sas . I tried again with width=10in height=7in today and it worked. I'm pretty sure I was testing in a fresh session yesterday, so not sure how I managed to muck it up.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.