BookmarkSubscribe
🔒 This topic is solved and locked.

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

data_null__
Jade | Level 19

KM plot with a nested plot as if it were an INSET.

This format can be seen in the New England Journal of Medicine.

 

Can I make this with ODS graphics, GTL?

 

nejmoa1612917_f2.jpg

0 Likes
1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Re: KM plot with a nested plot as if it were an INSET.

I actually demonstrate this annotation technique in the following paper, on pages 8-10:

Now You Can Annotate Your GTL Graphs! - PharmaSUG

 

Hope this helps!

Dan

View solution in original post

0 Likes
7 REPLIES 7
WarrenKuhfeld
Rhodochrosite | Level 12

Re: KM plot with a nested plot as if it were an INSET.

I would imagine you could make a graph, store it as an image, then make the outer graph and bring in the image for the inner graph through SG Annotation.  That's all that pops into my mind this close to bed time.

0 Likes
DanH_sas
SAS Super FREQ

Re: KM plot with a nested plot as if it were an INSET.

I actually demonstrate this annotation technique in the following paper, on pages 8-10:

Now You Can Annotate Your GTL Graphs! - PharmaSUG

 

Hope this helps!

Dan

View solution in original post

0 Likes
WarrenKuhfeld
Rhodochrosite | Level 12

Re: KM plot with a nested plot as if it were an INSET.

Great example, Dan! Here is a simple example I worked up that illustrates the principles involved.
Very cool technique! I have never done this before. (edited since part of my code was with the text).

 


ods graphics on / reset=all imagename="Inset" height=120px width=160px border=off;
proc sgplot data=sashelp.class; hbar sex / barwidth=0.5; yaxis display=(nolabel); xaxis display=(nolabel); run; data anno; retain function "image" width 30 x1 1 y1 99 anchor "topleft" drawspace "wallpercent" image 'Inset.png'; run; ods graphics on / reset=all imagename="Embedding"; proc sgplot data=sashelp.class sganno=anno noautolegend; styleattrs datacolors=(blue red) datasymbols=(circlefilled); scatter y=weight x=height / group=sex; run;
Jay54
Meteorite | Level 14

Re: KM plot with a nested plot as if it were an INSET.

This would work better if you provide a size for the inset image, and make sure it is placed in the right location.

 

ods html close;
ods listing gpath='c:\';
ods graphics / reset width=2in height=1.5in imagename='Inset';
proc sgplot data=sashelp.class;
hbar sex / barwidth=0.5;
yaxis display=(nolabel);
xaxis display=(nolabel);
run;

data anno;
retain function "image" width 30 x1 1 y1 99 anchor "topleft"
drawspace "wallpercent" image 'c:\Inset.png';
run;

ods graphics on / reset=all imagename="Embedding";
proc sgplot data=sashelp.class sganno=anno noautolegend;
styleattrs datacolors=(blue red) datasymbols=(circlefilled);
scatter y=weight x=height / group=sex;
run;

 

Embedding.png

0 Likes
WarrenKuhfeld
Rhodochrosite | Level 12

Re: KM plot with a nested plot as if it were an INSET.

Sorry.  Copy and paste error on my part.  Here it is including my initial statement, which does specify a size.

 

ods graphics on / reset=all imagename="Inset" height=120px width=160px border=off;

proc sgplot data=sashelp.class;
   hbar sex / barwidth=0.5;
   yaxis display=(nolabel);
   xaxis display=(nolabel);
run;

data anno;
   retain function "image" width 30 x1 1 y1 99 anchor "topleft"
          drawspace "wallpercent" image 'Inset.png';
run;

ods graphics on / reset=all imagename="Embedding";
proc sgplot data=sashelp.class sganno=anno noautolegend;
   styleattrs datacolors=(blue red) datasymbols=(circlefilled);
   scatter y=weight x=height / group=sex;
run;
data_null__
Jade | Level 19

Re: KM plot with a nested plot as if it were an INSET.


@WarrenKuhfeld wrote:

Great example, Dan! Here is a simple example I worked up that illustrates the principles involved.
Very cool technique! I have never done this before. (edited since part of my code was with the text).

 


ods graphics on / reset=all imagename="Inset" height=120px width=160px border=off;
proc sgplot data=sashelp.class; hbar sex / barwidth=0.5; yaxis display=(nolabel); xaxis display=(nolabel); run; data anno; retain function "image" width 30 x1 1 y1 99 anchor "topleft" drawspace "wallpercent" image 'Inset.png'; run; ods graphics on / reset=all imagename="Embedding"; proc sgplot data=sashelp.class sganno=anno noautolegend; styleattrs datacolors=(blue red) datasymbols=(circlefilled); scatter y=weight x=height / group=sex; run;

Hi Warren,

 

Thanks for the helpful example.  I think this technique is going to be very useful to me.

 

 

0 Likes
data_null__
Jade | Level 19

Re: KM plot with a nested plot as if it were an INSET.


@DanH_sas wrote:

I actually demonstrate this annotation technique in the following paper, on pages 8-10:

Now You Can Annotate Your GTL Graphs! - PharmaSUG

 

Hope this helps!

Dan


Thanks so much Dan, I figured it would be annotate but I would never have known the proper options/statements without seeing your example.

 

 

0 Likes
How to Concatenate Values

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.

Recommended by SAS
These recommendations are generated using AI from SAS. For personalized recommendations, sign in with your SAS profile.
Discussion stats
  • 7 replies
  • 1331 views
  • 2 likes
  • 4 in conversation