Data visualization with SAS programming

gplot data label orientation

Reply
N/A
Posts: 0

gplot data label orientation

I'm trying to do a line graph in gplot and put the values into the chart for each point.

I got the values but can't seem to get the text rotated into a vertical direction.

what is the best way to do this?
SAS Employee
Posts: 980

Re: gplot data label orientation

Are you using "pointlabels" or "annotated text"?

And what version of SAS are you using?
N/A
Posts: 0

Re: gplot data label orientation

I'm looking into pointlabels but I don't see any way of rotating the text
SAS Employee
Posts: 980

Re: gplot data label orientation

If you've got the latest v9.2, you can rotate pointlabels as follows. Pointlabels were enhanced in v9.2, and I'm not sure if this capability was available in earlier releases.

(I strongly encourage everyone to use the latest/greatest version of SAS/Graph, because there are always lots of nice fixes & features added in each version!)


symbol1 v=dot i=none pointlabel=(h=8pt a=90 "#name");
proc gplot data=sashelp.class;
plot height*weight=1;
run;
N/A
Posts: 0

Re: gplot data label orientation

unfortunately I'm running 9.1 (can't upgrade)

I tried a=90 and that rotated the labels (there was nothing in the documentation about this).

I'm managed to rotate the labels with
symbol1 color=red interpol=join v=dot height=.75
POINTLABEL=(a=90 c=red h=.75 J=C POSITION=TOP f="Arial") ;

but I noticed something....the labels are not always above the point plotted
SAS Employee
Posts: 980

Re: gplot data label orientation

It's a little difficult to predict & control the exact placement of pointlabel text, with interactions of things like rotate and collision-avoidance, etc.

Therefore you might prefer to annotate the text labels on the points, such as...


data my_anno; set sashelp.class;
xsys='2'; ysys='2'; hsys='3';
function='label'; position='6'; angle=90;
x=weight; y=height;
text=' '||trim(left(name));
run;

goptions reset=symbol;
symbol1 v=dot i=none;
proc gplot data=sashelp.class anno=my_anno;
plot height*weight=1;
run;
N/A
Posts: 0

Re: gplot data label orientation

thanks

that worked

I was trying to avoid anything like that because I probably will need to give the final program to others to use and I did not want to use anything that they have not seen before.
Ask a Question
Discussion stats
  • 6 replies
  • 331 views
  • 1 like
  • 2 in conversation