Data visualization with SAS programming

Insert graphic to right of graph

Accepted Solution Solved
Reply
Contributor
Posts: 40
Accepted Solution

Insert graphic to right of graph

Hello,

I would like to insert a graphic to the right of a graph I have created. (The graph was created using proc gchart).  I have created three lines using the annotate data set and would like to insert a graphic that gives an explanation as to what these lines are - like a legend of sorts.  I have tried just inserting text above the lines where the annotate date set, but that doesn't work in this case.  (It does the job. I just don't like the way it looks on the graph.)  

 

I know I could add an image below the graph, but for space purposes I would prefer it to the right.

 

Is this possible in SAS?  If so, can someone direct me to a resource that has information related to this?  I have searched online but can't find information related to this.  

 

Thanks,

KelseyB


Accepted Solutions
Solution
‎10-21-2015 10:07 AM
SAS Super FREQ
Posts: 1,081

Re: Insert graphic to right of graph

Update.  Actually, Fig 8 in the paper is closer to what you want.

View solution in original post


All Replies
Esteemed Advisor
Esteemed Advisor
Posts: 7,256

Re: Insert graphic to right of graph

Well, you can put outputs out to multiple regions using ods region:

http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p0g1r9d5mqtuezn1g3sv...

 

Not sure how this ties into your code, I would suggest you move to sgplot or GTL though, more flexibility.

Contributor
Posts: 40

Re: Insert graphic to right of graph

Thanks RW9.  I am not sure how ods region would work since I want one column at the top of the page and essentially two columns at the bottom - one with the graph, the other with the image next to it.  I am also going to look at sgplot though.  You mentioned GTL. I am not sure how to use that for this.

SAS Super FREQ
Posts: 1,081

Re: Insert graphic to right of graph

Using SGPLOT, you can reserve some space to the right of the graph (PAD=(RIGHT=10pct)), and then add the image in that location using SGANNO functioni.  Note, this works similar to Annotate, with Functions, etc, but has different syntax due to its need to work with SGPLOT.

Contributor
Posts: 40

Re: Insert graphic to right of graph

Thank you Sanjay_SAS for the tip.  I am going to try sgplot for this right now.

SAS Super FREQ
Posts: 1,081

Re: Insert graphic to right of graph

This paper explains how to add SGANNO annotations to a SGPLOT graph.  Images are included in the data in Fig 11.  It should be straight forward to place images on the right of the graph.

http://support.sas.com/rnd/datavisualization/papers/sgf2011/277-2011.pdf

 

Contributor
Posts: 40

Re: Insert graphic to right of graph

Thank you.  I will check this paper out.  

Solution
‎10-21-2015 10:07 AM
SAS Super FREQ
Posts: 1,081

Re: Insert graphic to right of graph

Update.  Actually, Fig 8 in the paper is closer to what you want.

Contributor
Posts: 40

Re: Insert graphic to right of graph

Thanks.  That is the one I am looking at right now.

Contributor
Posts: 40

Re: Insert graphic to right of graph

I am going to mark this as a solution.  I am still playing around to get things to fit, but I feel confident that I am on the right track. Thanks again!

Esteemed Advisor
Esteemed Advisor
Posts: 7,256

Re: Insert graphic to right of graph

Well, I see Sanjay has jumped in and given you a solution which is great.  I would just add, as he is too modest, that his excellent blog will give you all the information you need to use sgplot and GTL (Graph Template Language) which is the underlying graph proc template language which is used to generate graphs.

http://blogs.sas.com/content/graphicallyspeaking/

(although in this instance, it was a different solution, its still a good idea to look into.)

Contributor
Posts: 40

Re: Insert graphic to right of graph

Thanks RW9.  Wow!  Yes, this looks like it has a lot of really useful information.  

☑ This topic is SOLVED.

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

Discussion stats
  • 11 replies
  • 639 views
  • 1 like
  • 3 in conversation