- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Using SGPLOT for the first time and need help figuring out how to adjust/compress the Y-axis so that the legend can appear on the graph. As of now, the legend is absent from the graphs. I;ve looked through the documentation but haven't found anything that specifically addresses this. Any and all ideas are appreciated.
proc sgplot data=survplot4;
step x=time y=survival / group=stratum name='s';
xaxis min=0 max=360 values=(0 to 360 by 60); title 'Survival in Months';
yaxis min=0 max=1 values=(0 to 1 by 0.1);
keylegend 's' / linelength=20;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
On the ODS GRAPHICS statement, specify a larger LEGENDAREAMAX value. The default is 20% of your graph space. After that, the legend is dropped. Here is the doc for the option: https://go.documentation.sas.com/?docsetId=grstatproc&docsetTarget=p0kroq43yu0lspn16hk1u4c65lti.htm&...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How long is the text displayed in the legend for your group variable STRATUM? I normally would not expect 20 groups to exceed the default area for a legend but if your text values are long I would also suggest considering if the current text could be reduced.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response.
I have 8 groups in my strata. I have shortened the names but still am not able to get the legend to appear. As well, I've tried adjusting the items suggested in the log to no avail.
NOTE: Some graph legends have been dropped due to size constraints. Try adjusting the MAXLEGENDAREA=,
WIDTH= and HEIGHT= options in the ODS GRAPHICS statement.
As well, I've tried adjusting the items suggested in the log to no avail. The legend remains absent. My other graphs using the same data run nicely, ust not this particular graph. I'm not sure how to proceed. Do you have further recommendations? Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That did the trick!. I wasn't using "reset" before MAXLEGENDAREA.
Many thanks.