Data visualization with SAS programming

Customizing size and font of SGPLOT graphs in PDF

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Customizing size and font of SGPLOT graphs in PDF

[ Edited ]

Hi all, 

 

I'm trying to output my 3 graphs I produced using SGPLOT into PDF. I use ods graphics options to try to control for the size and fonts of the graphics but the graphs keep turning out to be way to small for an 8x11 paper. I've uploaded a sample output. Below is my code:

 

 

goptions /*reset=all*/ device=PDF ftitle="Thorndale AMT" ftext="Thorndale AMT" noborder;
options papersize=letter nodate nonumber orientation=landscape leftmargin=.5in rightmargin=.5in topmargin=.5in bottommargin=.5in;
options nobyline;

ods pdf file="&odsfile" dpi=300;
ods graphics on reset=all/ width=10in scale=on border=off imagefmt=png; /*outputfmt=pdf; */

 

title1 J=C font="&font/bold" H=14pt "TITLE";
Footnote1 f="Thorndale AMT" justify=left h=10pt "FOOTNOTE";


proc sgplot data=SOURCE; 


series x=TIME y=PRICE/
lineattrs=(pattern=1)
group=CUSTOMER
grouplc=CUSTOMER
name='grouping';
keylegend 'grouping' / type=linecolor;
xaxis label="Time" values=(0 to 108 by 6);
yaxis label="Price Change" values=(-0.6 to 0.6 by 0.1);
refline 0/ lineattrs=(thickness=0.5 color=black);
format TIME best12. PRICE percent7.2;
run;

 

ods pdf close;

 

The title is positioned where I want it to ve (i.e. follows the margin of 0.5 inch left/right as coded) but the graph itself is still very tiny even after I set it as width=10in under ods graphics. Anyone know what the problem is? 

 

Thanks!

 

 


Untitled.png

Accepted Solutions
Solution
‎02-19-2016 12:10 PM
SAS Super FREQ
Posts: 3,618

Re: Customizing size and font of SGPLOT graphs in PDF

A few notes:

1) You don't need ODS GRAPHICS ON to call PROC SGPLOT.

2) Be sure to put the RESET=ALL option after the slash. The way you have it is a syntax error.

 

ODS graphics on / reset width=10in scale=on border=off imagefmt=png;

 

 

View solution in original post


All Replies
Super User
Posts: 19,034

Re: Customizing size and font of SGPLOT graphs in PDF

Just a note that GOPTIONS don't affect the ODS Graphics output, and SGPLOT is under ODS Graphics.

SAS Super FREQ
Posts: 925

Re: Customizing size and font of SGPLOT graphs in PDF

I do not get a "tiny" graph at SAS 9.4m3. What version of SAS are you using? Also, you might want to remove the NOGTITLE option to reclaim some of the space between the graph and the title.

New Contributor
Posts: 4

Re: Customizing size and font of SGPLOT graphs in PDF

I'm using SAS 9.4 TS Level 1M2. I got rid of NOGTITLE but seems to have no change. The overall graph and titles are all shown in a small box that's not fitted to the size of the pdf. I uploaded the sample output hope it helps.
SAS Super FREQ
Posts: 925

Re: Customizing size and font of SGPLOT graphs in PDF

I still was not able to reproduce the problem with the given test program; but looking at the picture you uploaded, it looks like the most likely culprit is an ODS GRAPHICS / RESET hiding somewhere in your code that effectively resets your graph size to 640x480.

Solution
‎02-19-2016 12:10 PM
SAS Super FREQ
Posts: 3,618

Re: Customizing size and font of SGPLOT graphs in PDF

A few notes:

1) You don't need ODS GRAPHICS ON to call PROC SGPLOT.

2) Be sure to put the RESET=ALL option after the slash. The way you have it is a syntax error.

 

ODS graphics on / reset width=10in scale=on border=off imagefmt=png;

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 1289 views
  • 0 likes
  • 4 in conversation