From: Jay Weedon on
1. Is it possible to specify a fill color for bars produced using the
interpolate=hilob specification on a symbol statement?

2. Is it possible to control the width of href & vref lines?

TIA,
JW
From: Richard A. DeVenezia on
Jay Weedon wrote:
> 1. Is it possible to specify a fill color for bars produced using the
> interpolate=hilob specification on a symbol statement?
>
> 2. Is it possible to control the width of href & vref lines?

You might get better boxplots from Proc BOXPLOT. However, you can mimic the
features to some extent in GPLOT. (There might also be a stat graphic macro
for all manner of box plotting found in Michael Friendly's pages,
http://www.math.yorku.ca/SCS/friendly.html )

There is no fill color for the bars, but a plot and plot2 using different
symbols can give the appearance of a fill color.
The VREF and HREF lines don't have options for their height/width. Thick
reference lines can be drawn using annotation. If you want the labels as
well, use the *REF options _and_ the annotation.

Example:
----------------------------------
%let seed = 1234;

data foo;
do teamId = 1 to 7;
do _n_ = 1 to 5 + 10*ranuni(&seed);
playerId + 1;
score = floor(50 + 50 * rannor(&seed));
output;
end;
end;
run;

%annomac
data annoref;
%dclanno
x=3; y=0; xsys='2'; ysys='1'; function='MOVE'; output;
y=100; color='RED'; size=16; function='DRAW'; output;

x=0; y=50; xsys='1'; ysys='2'; function='MOVE'; output;
x=100; function='DRAW'; output;
run;

goptions reset=all;

ods listing close;
ods pdf file="%sysfunc(pathname(work))\foo.pdf";

symbol1 i=HiLoB bwidth=5cm color=cxaaaaff width=100;
symbol2 i=HiLoB bwidth=10cm color=black width=15 ;
axis1 offset=(1cm,1cm) ;

proc gplot data=foo;
plot score * teamId / haxis = axis1 href=5 chref=red lhref=33 ;
plot2 score * teamId / anno = annoref;
run;quit;

ods pdf close;
ods listing;

dm results ';' results;
----------------------------------

Remember, in graphics, it's not what you see, but what you think you see
that's important.

--
Richard A. DeVenezia
http://www.devenezia.com/


From: nina harris on
Richard A. DeVenezia wrote:
> dm results ';' results;

richard, nice example.
can you explain why the "dm results" line works the way it does (it brings up adobe
automatically) ?

From: Jay Weedon on
On Tue, 7 Mar 2006 22:56:37 -0500, "Richard A. DeVenezia"
<rdevenezia(a)wildblue.net> wrote:

>Jay Weedon wrote:
>> 1. Is it possible to specify a fill color for bars produced using the
>> interpolate=hilob specification on a symbol statement?
>>
>> 2. Is it possible to control the width of href & vref lines?
>
>You might get better boxplots from Proc BOXPLOT. However, you can mimic the
>features to some extent in GPLOT. (There might also be a stat graphic macro
>for all manner of box plotting found in Michael Friendly's pages,
>http://www.math.yorku.ca/SCS/friendly.html )
>
>There is no fill color for the bars, but a plot and plot2 using different
>symbols can give the appearance of a fill color.
>The VREF and HREF lines don't have options for their height/width. Thick
>reference lines can be drawn using annotation. If you want the labels as
>well, use the *REF options _and_ the annotation.
>
>Example:
>----------------------------------
>%let seed = 1234;
>
>data foo;
> do teamId = 1 to 7;
> do _n_ = 1 to 5 + 10*ranuni(&seed);
> playerId + 1;
> score = floor(50 + 50 * rannor(&seed));
> output;
> end;
> end;
>run;
>
>%annomac
>data annoref;
> %dclanno
> x=3; y=0; xsys='2'; ysys='1'; function='MOVE'; output;
> y=100; color='RED'; size=16; function='DRAW'; output;
>
> x=0; y=50; xsys='1'; ysys='2'; function='MOVE'; output;
> x=100; function='DRAW'; output;
>run;
>
>goptions reset=all;
>
>ods listing close;
>ods pdf file="%sysfunc(pathname(work))\foo.pdf";
>
>symbol1 i=HiLoB bwidth=5cm color=cxaaaaff width=100;
>symbol2 i=HiLoB bwidth=10cm color=black width=15 ;
>axis1 offset=(1cm,1cm) ;
>
>proc gplot data=foo;
> plot score * teamId / haxis = axis1 href=5 chref=red lhref=33 ;
> plot2 score * teamId / anno = annoref;
>run;quit;
>
>ods pdf close;
>ods listing;
>
>dm results ';' results;
>----------------------------------
>
>Remember, in graphics, it's not what you see, but what you think you see
>that's important.

Many thanks for you suggestions. I don't want a box plot, I want a bar
chart showing group means with an "error whisker" at the top (or
bottom if the mean is negative). This is how biologists always seem to
want to display results.

The length of the whiskers is pre-specified by my model, so I can't
use the errorbar option in proc gchart, which does some calculation
that I don't want.

I've figured a way to do it using a datastep to calculate 2 scores,
one of which represents the column, the other the whisker, and using
code like

symbol1 c=black i=hilocb w=4 bwidth=10;
symbol2 c=black i=hiloct w=4;

proc gplot;
plot (score1 score2)*gp
/overlay vref=(0 4e-4 -4e-4 8e-4 -8e-4 12e-4 -12e-4);
run;

The multiple vrefs simulates a thick line. I can use the chart editor
to add fill colors but it has to be done manually and separately for
each column so it's a pain. I've sworn never to go near proc annotate!

JW
From: Richard A. DeVenezia on
nina harris wrote:
> Richard A. DeVenezia wrote:
>> dm results ';' results;
>
> richard, nice example.
> can you explain why the "dm results" line works the way it does (it
> brings up adobe automatically) ?

The DM statement is an interesting one.

DM <switch to this window> <issue this command> <switch to this window>;

Essentially, the second RESULTS causes the display manager to bring the
results window to the front.

I did this because the default behavior (on my system) when ODS PDF CLOSE
occurs is that the preview window appears and then the enhanced editor
window is raised to the front.

--
Richard A. DeVenezia
http://www.devenezia.com/