I have a vector plot with annotations, but the footnotes overlap the x-axis annotations.
1. Is there a workaround for this?
2. The font for the x-axis labels does not change even though I changed in the annotation dataset. Any suggestions?
data anno;
length x1space $11 textweight label $100;
x1space='datavalue';
y1space='wallpercent';
function='text';
textcolor='black';
anchor='top';
fontsize = '6pt';
font = 'Courier New';
array lux[10] lux1-lux10 (999 500 178 63 22 8 3 1 .35 .125);
do x1=8 to 17 ;
fontsize = '6pt';
font = 'Courier New';
y1=-1;
label=compress(put(x1,6.));
output;
y1=-5;
if lux[x1-7] = 999 then label = ">500";else
if lux[x1-7] >=1 then label=compress(put(lux[x1-7],6.));else
if lux[x1-7] = .35 then label = '0.35';else
if lux[x1-7] = .125 then label ='0.125';
output;
/* y1=-9;*/
/* label='Lux';*/
/* output;*/
end;
x1space='datapercent';
x1=50;
y1=-14;
label='Score / Lux';
textweight='normal';
fontsize = '6pt';
font = 'Courier New';
output;
run;
The default ANCHOR for text is CENTER. For your footnote text, you will want to set the ANCHOR to be BOTTOMLEFT. That way, the footnote length can grow and shrink but never move on the left side.
I can't see all of your code, but I think the following is your solution:
Hope this helps!
Dan:
That helped quite a bit. Regarding how you position text.
One footnote was considerably longer than the other. I used layoutpercent and then had to use an X1 value of 12 with the shorter text and an X1 value of 40 with the longer text. I thought that the X1 value of say 10 would get me what I want. But when I did this, the annotation text ran off the left margin.
How does this work?
The default ANCHOR for text is CENTER. For your footnote text, you will want to set the ANCHOR to be BOTTOMLEFT. That way, the footnote length can grow and shrink but never move on the left side.
Dan,
On a related item. This particular vector plot has no legend. However, my starting value is represented by a circle and the ending value is represented by an arrow. Can this be done with a keylegend statement or does it have to be done with annotations?
Use two LEGENDITEM statements (one for each item) and add them (by name) to your KEYLEGEND like you would a plot. Let me know if you cannot find an example of this technique.
For the arrow, use a "right triangle" marker as the arrow in the LEGENDITEM definition.
This swimmer plot example uses that technique: https://blogs.sas.com/content/graphicallyspeaking/2018/11/16/waterfall-graph-with-more-data-for-subj...
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.