Data visualization with SAS programming

removing blank space between chart and legend

Reply
N/A
Posts: 0

removing blank space between chart and legend

I have a number of gcharts. I've placed the legend at the bottom center but this often leaves a large blank space on the page. Is there a way of moving the legend up against the chart?
SAS Employee
Posts: 977

Re: removing blank space between chart and legend

With traditional SAS/Graph procs (such as gchart), you can use a legend statement, and specify mode=share and/or specify an offset= to move the legend from the default location.

For example, you could use a blank footnote statement to add the desired amount of white-space at the bottom of the page:

footnote1 height=5pct " ";

And then a legend statement something like the following untested pseudo-code...

legend1 mode=share position=(bottom middle) offset=(0,-5);
N/A
Posts: 0

Re: removing blank space between chart and legend

So there is no way to dynamically set this. It has to be set differently for each chart.

I have some 50 charts all of which are generated fairly dynamically so I don't need to change much over time. I need a way of setting this that does no require me to manually tweak each chart.
SAS Employee
Posts: 977

Re: removing blank space between chart and legend

Are you saying the number of items in the legend varies (a lot) for each chart?

If the legend varies a lot for each chart, you might need to just let it auto-position for each one (if you manually tweak the legend, it can be hard to guarantee it will work with all graphs, if the number of items in the legend varies greatly).
Super Contributor
Posts: 291

Re: removing blank space between chart and legend

Bill;

There's lots of good help in sashelp. Look for legend statement under SAS/GRAPH Statements
Ask a Question
Discussion stats
  • 4 replies
  • 208 views
  • 0 likes
  • 3 in conversation