- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How to change plot size in proc sgplot? NOT graph size (which includes the plot itself, title, axis titles, etc.), but only the area bound by axes.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
One option (if you really do want to control the actual length of the axes ... not just the offset/origin so 2 graphs line up) is to use SAS/Graph gplot, which lets you directly specify the length of the axes. Here is an example:
goptions xpixels=400 ypixels=400 border cback=pink;
axis1 length=2.2in origin=(35pct,25pct);
axis2 length=2.2in;
proc gplot data=sashelp.class;
plot height*weight / haxis=axis1 vaxis=axis2;
run;
proc gplot data=sashelp.class;
plot name*weight / haxis=axis1 vaxis=axis2;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
xaxis min= max=
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's just a set of basic plots:
********
ods graphics on / width=500PX height=400PX;
proc sgplot data=mydata;
by variable1;
scatter x=variable2 y=variable3 / colorresponse=variable4;
run;
*********
Options "width" and "height" control the size of the outer edge of the entire graph. (Graph - the entire object, plot - inner rectangle bound by axes). Later on I'll be displaying multiple plots on one page and cropping outer margins. Since the scale labels (number of digits) vary from graph to graph, SAS resizes plots, while keeping graph size the same (500PX by 400PX). I want to control the size of inner plot rather than the entire graph.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you look at SGPANEL instead of SGPLOT?
Still not sure quite what you need but in SGPANEL you have some options to maintain row/column axis the same.
Have you looked at the SGPLOT ASPECT= option to play with ratios of wall areas?
proc sgplot data=sashelp.class; scatter x=height y=weight; run; proc sgplot data=sashelp.class aspect=1; scatter x=height y=weight; run;
Or moving to the Graphics Template Language provides more controls.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'll clarify what I mean on the picture below:
Note how width of the graph (L) defined by the code (width= ) stays the same, while width of the plot (d) changes automatically to fit the content. I want to control width and height of the plot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Maybe it is NOT what you want. @GraphGuy might have solution.
proc sgplot data=sashelp.class ;
scatter x=height y=weight;
xaxis offsetmax=0.5 valueshint;
yaxis offsetmax=0.1 valueshint;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think this issue has been discussed at
Options include SGPANEL or GTL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
One option (if you really do want to control the actual length of the axes ... not just the offset/origin so 2 graphs line up) is to use SAS/Graph gplot, which lets you directly specify the length of the axes. Here is an example:
goptions xpixels=400 ypixels=400 border cback=pink;
axis1 length=2.2in origin=(35pct,25pct);
axis2 length=2.2in;
proc gplot data=sashelp.class;
plot height*weight / haxis=axis1 vaxis=axis2;
run;
proc gplot data=sashelp.class;
plot name*weight / haxis=axis1 vaxis=axis2;
run;