Embed a smaller graph into the graph window
of a larger graph using Proc Greplay
*******************************************
****Data used is the average concentration at each timepoint, grouped by dose****
***plot data on linear scale, main graph;
goptions
reset=ALL
gunit=pct
colors=(black)
ftext=hwcgm001
ftitle=hwcgm009
htext=3
noborder
maxcolors=255
device=CGMOFML
hsize=10 in vsize=8;
symbol1 value=diamond i=j color=black h=2.5;
symbol2 value=triangle i=j color=black h=2.5;
symbol3 value=circle i=j color=black h=2.5;
symbol4 value=square i=j color=black h=2.5;
symbol5 value=dot i=j color=black h=2.5;
symbol6 value=diamond i=j color=black h=2.5;
symbol7 value=triangle i=j color=black h=2.5;
symbol8 value=circle i=j color=black h=2.5;
axis1 value=(a=90 h=3pct "0" "200" "400" "600" "800") order=(0 to 800 by 200) minor=none label=(a=90 color=black "Mean Concentration") offset=(1);
axis2 order=(0 to 80 by 20) minor=none label=(color=black "Time (hr)") offset=(1);
legend1 down=11 position=(right bottom inside) mode=share label=none value=(justify=left "10mg " "30mg " "90mg " "200mg " "500mg " "1000mg " "1500mg " "2000mg " );
*down=11 will push the legend up from it's original position at the bottom right;
proc gplot data=graphdata;
plot concentration*time=dose/run;
vaxis=axis1
haxis=axis2
legend=legend1;
quit;
***2nd plot in log scale to be embedded;
symbol1 value=diamond i=j color=black h=2.5;
symbol2 value=triangle i=j color=black h=2.5;
symbol3 value=circle i=j color=black h=2.5;
symbol4 value=square i=j color=black h=2.5;
symbol5 value=dot i=j color=black h=2.5;
symbol6 value=diamond i=j color=black h=2.5;
symbol7 value=triangle i=j color=black h=2.5;
symbol8 value=circle i=j color=black h=2.5;
axis1 order=(.5,5,50,500) logbase=10 logstyle=expand label=none;
axis2 order=(0 to 80 by 20) minor=none label=none;
goptions hsize=5 in vsize=3 in noborder htext=3;
proc gplot data=graphdata;
plot concentration*time=dose/nolegend noframerun;
vaxis=axis1
haxis=axis2;
quit;
*******Embed the second graph into the upper right area of the first graph;
filename outplot 'Z:\Embedded\Embeddedgraph.cgm';
goptions hsize=10 in vsize=8 in display gsfmode=replace gsfname=outplot;
proc greplay igout=work.gseg nofs;
tc work.templts;run;
tdef newtemp
1/llx=1 lly=1
ulx=1 uly=99
urx=99 ury=99
lrx=99 lry=1
2/llx=50 lly=50
ulx=50 uly=94.0
urx=98.2 ury=94.0
lrx=98.2 lry=50
clip;
template newtemp;
treplay 1:gplot 2:gplot1;
*make sure graphs are numbered properly from output screen;
quit;
filename outplot clear;
**See also:
1. SAS Example
No comments:
Post a Comment