Date: Tue, 2 Jun 2009 11:28:02 -0400
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: gplot
Content-Type: text/plain;charset=iso-8859-1
hi ... since I don't have your data, it's hard to answer that question
so, I'll ask a question then show an example similar to yours using data I do have ... SASHELP.CLASS
question ... you are using the annotate data set to place a circle on the plot (with color controlled by
the value if series) ... you are using GPLOT to plot the circles (via annotate) and you want to use
a symbol + the pointlabel option to add text (the rate) to each circle
so, why not just use ...
symbol1 v=none i=none c=black pointlabel=(h=0.4 '#rate');
title "Bubble Plot";
proc gplot data=occ anno=annobub;
plot rate * LVL10 /
vref=23
lvref=34
cvref=red
autovref autohref
nolegend
noframe
lhref=3
vaxis=axis1
haxis=axis2;
;
run;
quit;
that gives circles (via annotate) with text labels (via the symbol statement)
here's my example (based on your code but using different data plus my suggestion about the symbol and plot statement) ...
data annobub;
set sashelp.class;
length function color $8;
retain xsys ysys '2' hsys '3' when 'b';
xc=name;
y=height;
function='pie';
rotate=360;
if sex eq 'M' then color='CXE5B82E';
if sex eq 'F' then color='CXD9576E';
size=height/30;
position='4';
style='psolid';
output;
run;
proc sql noprint;
select quote(name) into :lvl10x separated by ' ' from sashelp.class;
quit;
goptions reset=all rotate=landscape gunit=pct;
axis1 offset=(0,0) value=(f=swissb) label=none minor=none;
axis2 offset=(3,3) value=(f=swissb h=1) label=none order=(&lvl10x);
symbol1 v=none i=none c=black pointlabel=(h=2.0 '#height');
title "Bubble Plot";
proc gplot data=sashelp.class anno=annobub;
plot height * name /
cvref=red
autovref autohref
nolegend
noframe
lhref=3
vaxis=axis1
haxis=axis2
;
run;
quit;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> Thanks. The plot seems to be pretty good now.
> My only problem now is that when series=2 there's a square in the
> middle of the circle.
> Do you know how to get rid of this square (when series=1 there is no
> square which is what I want)?
>
> data occ;
> set occa;
> if rate>20 then series=1;
> if rate<=20 then series=2;
> run;
> data annobub;
> set occ;
> length function color $8;
> retain xsys ysys '2' hsys '3' when 'b';
> xc=LVL10;
> y=rate;
> function='pie';
> rotate=360;
> if series eq 1 then color='CXE5B82E';
> if series eq 2 then color='CXD9576E';
> size=avg_emp/6;
> position='4';
> style='psolid';
> output;
> run;
>
> proc sql noprint;
> select quote(LVL10) into :lvl10x separated by ' ' from occ;
> quit;
>
> GOPTIONS reset=all rotate=landscape device=ACTIVEX;
> axis1 offset=(0,0) value=(f=swissb) label=none minor=none
> reflabel=(j=c 'Average');
> axis2 offset=(3,3) value=(f=swissb h=1) label=none order=(&lvl10x);
> symbol i=none v=none;
> symbol1 v=none i=none c=black pointlabel=(h=0.4 '#rate');
> title "Bubble Plot";
> proc gplot data=occ anno=annobub;
> plot rate * LVL10=series /
> vref=23
> lvref=34
> cvref=red
> autovref autohref
> nolegend
> noframe
> lhref=3
> vaxis=axis1
> haxis=axis2;
> ;
> run;
>
>