10-20-2015 07:30 PM
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.
10-21-2015 05:42 AM
Well, you can put outputs out to multiple regions using ods region:
Not sure how this ties into your code, I would suggest you move to sgplot or GTL though, more flexibility.
10-21-2015 08:57 AM
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.
10-21-2015 09:00 AM
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.
10-21-2015 09:30 AM
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.
10-21-2015 10:07 AM
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!
10-21-2015 10:03 AM
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.
(although in this instance, it was a different solution, its still a good idea to look into.)
Need further help from the community? Please ask a new question.