Data visualization with SAS programming

GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

[ Edited ]

Hi everyone,

 

I have been working on a template based off of a simular concept fo Sanjay's KM curves with At risk values being outside of the graph as seen here:

http://blogs.sas.com/content/graphicallyspeaking/2014/02/09/survival-plot/

(Specifically the SAS 9.3 Survival Plot with AtRisk Values outside the plot, specifically this version: http://blogs.sas.com/content/graphicallyspeaking/files/2014/02/SurvivalPlotAtRisk_Outside_Scatter_93... )

 

My problem is that if you have an extremely long group label, it pushes the y-axis label even further to the left.

Is there a way to change this and push the label closer to the graph?

I figured an extreme worst case situation would be to have the label be blank and then use drawtext to have it show up as a mock label? I have googled around on this topic and read some papers but didn't have much luck with any examples of using drawtext (or anything like that) to rotate and replicate a label.

 

ADDITIONALLY: In this example, if you have an extremely large count in your at risk set (like 10000 subjects at time 0) the x-axis and 0 has a large gap at the beginning. Is there any way to force the 0 to be closer to the where the x-axis/y-axis combine?

 

 

 

 


Accepted Solutions
Solution
‎01-21-2016 10:23 AM
SAS Super FREQ
Posts: 1,080

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

Yes, you are on the right track.  That is exactly what I did in this example.  I am using SAS 9.4 with AxisTable.  This example is from my upcoming book on Clinical Graphs.  But, you can get a sneak preview. Smiley Happy  Turn off the Y axis label, and use this code.

 

/*--Draw the Y axis label closer to the axis--*/
drawtext textattrs=(size=8) 'Survival Probability' / x=-6 y=50 anchor=bottom
xspace=wallpercent yspace=wallpercent rotate=90 width=50;

View solution in original post

Attachment

All Replies
Solution
‎01-21-2016 10:23 AM
SAS Super FREQ
Posts: 1,080

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

Yes, you are on the right track.  That is exactly what I did in this example.  I am using SAS 9.4 with AxisTable.  This example is from my upcoming book on Clinical Graphs.  But, you can get a sneak preview. Smiley Happy  Turn off the Y axis label, and use this code.

 

/*--Draw the Y axis label closer to the axis--*/
drawtext textattrs=(size=8) 'Survival Probability' / x=-6 y=50 anchor=bottom
xspace=wallpercent yspace=wallpercent rotate=90 width=50;

Attachment
Occasional Contributor
Posts: 10

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

Thank you so much for your help Sanjay! The drawtext you provided really helped out. I will have to check out your new book when you have finished also.

 

I looked at your 9.4 example with AxisTable also, but it looks like that gap between the axis is still existing, but it's now disconnected. Is there no other way to push that gap in a little? (I've included an image of mine and how it's pushed further due to a large count).

 

Thanks,
Erica

Attachment
SAS Super FREQ
Posts: 889

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

You can use OFFSETMIN and OFFSETMAX to control the gaps at the "min" and the "max" of the axis.

SAS Super FREQ
Posts: 1,080

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

That gap is created to correctly align the first Risk Table value (13619) with the "0" value on the x axis.  You may have longer values further below, but is is not visible.  You could try using OFFSETMIN=0 on the X axis, but that may chop off some values.

SAS Super FREQ
Posts: 1,080

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

This is one reason I like to place the risk table inside the graph.  Proximity makes such things easier to see.

 

Attachment
Occasional Contributor
Posts: 10

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

Thanks Dan and Sanjay. I tried offsetmin in the x-axis prior to asking and didn't have any luck. It's a tricky situation because I do realize that it's that way because it lines up with the 0 tickmark. The research group I'm in have very strong preferences for the at risk values being outside of the graph, so while this is not a problem in the other method, I can't use it.

 

Thanks again for the help, I think it might be as good as I can get it without a smaller text font.

Occasional Contributor
Posts: 10

Re: GTL: Y-Axis Label Needs to be Pushed Right (Or created with drawtext?)

Actually, I put an offsetmin ALSO in the xaxisoptions for the risk set (I don't know why I didn't think of that earlier...) 

but it does now seem to push it over! Thanks again!!

☑ This topic is SOLVED.

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

Discussion stats
  • 7 replies
  • 585 views
  • 3 likes
  • 3 in conversation