Help using Base SAS procedures

Y-Axis positioning

Reply
Contributor
Posts: 32

Y-Axis positioning

Currently, I have some graphs that manually label the Y-Axis using annotate to position the label left justified, starting directly above the Y-Axis line and continuing above the frame of the graph. I have tried to convert this using LABEL= on an AXIS statement, but SAS is always placing the label to the far left, above the Y-Axis values.
Super Contributor
Posts: 291

Re: Y-Axis positioning

Please include some code in your posting. We need to see what you are doing.
Contributor
Posts: 32

Re: Y-Axis positioning

The current code has the following in a data step:
**** y label;
xsys='1';
ysys='1';
hsys='3';
x=0;
y=100;
text=Y-Axis label';
style="&hwfont1";
size=&stdsize*&sizeadj; * Different sizes for different outputs;
color="&black.";
position='3';
output;
Super Contributor
Posts: 291

Re: Y-Axis positioning

More code needed! What are you doing in the gplot routine that might be interfering with the annotate step?
Contributor
Posts: 32

Re: Y-Axis positioning

More code supplied (with certain names made generic)
proc gplot data=name anno=anno gout=ris.&gseg;
plot mutual*n
stock*n /
vaxis=axis1
haxis=axis2
frame
legend=legend1
vref=0
lvref=34
name='name'
overlay
des=DESC';

format mutual stock comma4.;

* I have tried using label= with values w/ no luck;
axis1 origin=(&xorg.,&yorg.)
value=(h=&htextsize. f=&hwfont1. c=&black.)
label=none
order=(&low. to &high. by &increm.)
major=(h=-0.9 c=&black.)
minor=none length=&ylength.;

axis2 label=none
value=none
major=none
minor=none
length=&xlength.
order=(1 to &lastn. by 1)
offset=(2.5,2.5)pct;

symbol1 c=&rblack. i=join v=none l=&line1. w=&linewide.;
symbol2 c=&bblack. i=join v=none l=&line2. w=&linewide.;
legend1 across=1 down=2
offset=(-1,-1)
mode=share
label=none
position=(top right inside)
value=(font=&hwfont1. justify=l h=&ltextsize.
tick=1 'item 1'
tick=2 'item 2') ;
run;
quit;
Contributor
Posts: 32

Re: Y-Axis positioning

Bill - I am trying to get away from a lot of old SAS/Graph code that relies too much on annotation for a lot of things (including tick marks, axis values and so on). Some of the code goes way back (15 years+). Most I can convert with no problems, the y-axis label positioning has me stumped.

Thanks
Super Contributor
Posts: 291

Re: Y-Axis positioning

David;

I don't see how to move the label to where you I think you want it. But I fooled the title into the correct location. Try it without the move(1,93)pct. I think it's right where you want it.

data test;
input x y;
datalines;
1 4
2 3
3 6
4 9
5 7
6 1
7 7
8 5
9 2
;
run;

goptions reset=all
dev=win;


title1 '"Right" justifying the Y axis label';
title3 j=l move=(1,93) pct 'Long Axis Label'; *move is optional;

axis1 label=none;
axis2 label=none;
symbol1 i=join l=1 c='cxd7301f';
proc gplot data=test;
plot y*x/vaxis=axis1
haxis=axis2
;
run;
quit;
Contributor
Posts: 32

Re: Y-Axis positioning

I like that trick. Maybe I will ask for an additional option as an enhancement on the label portion of the axis statement, something like location=inside to do what I want.

Thanks.
Ask a Question
Discussion stats
  • 7 replies
  • 138 views
  • 0 likes
  • 2 in conversation