From: hvidkjaer on
Hello

I would like to create a histogram with several variables plotted
against the horizontal variable. Now, this can be done using gplot and
a wide needle; something like the following:

symbol1 i=needle v=none w=32 color=red;
symbol2 i=needle v=none w=32 color=blue;

proc gplot data= bot;
plot verticalvar*horizontalvar=groupvar;
run;

However, when running this code, the automatically created horizontal
line at 0 on the vertical axis takes the width specified for symbol1.
With, say, w=32, the graph looks rather unattractive. The only way I
could see how to circumvent this, is to create dummy observations with
value 0, let symbol1 map to those, and set symbol1 w=1. However, is
there a cleaner way to code a thin horizontal line?

Thanks for any input.
Soeren Hvidkjaer
From: hvidkjaer on
On May 26, 11:07 am, "hvidkj...(a)gmail.com" <hvidkj...(a)gmail.com>
wrote:
> Hello
>
> I would like to create a histogram with several variables plotted
> against the horizontal variable. Now, this can be done using gplot and
> a wide needle; something like the following:
>
>     symbol1 i=needle v=none w=32 color=red;
>     symbol2 i=needle v=none w=32 color=blue;
>
>     proc gplot data= bot;
>         plot verticalvar*horizontalvar=groupvar;
>     run;
>
> However, when running this code, the automatically created horizontal
> line at 0 on the vertical axis takes the width specified for symbol1.
> With, say, w=32, the graph looks rather unattractive. The only way I
> could see how to circumvent this, is to create dummy observations with
> value 0, let symbol1 map to those, and set symbol1 w=1. However, is
> there a cleaner way to code a thin horizontal line?
>
> Thanks  for any input.
> Soeren Hvidkjaer

Actually, my understanding of the functionality was not correct.
Consider the following example:

data a;
do tmpvar = 1 to 10;
do groupvar = -1 to 1;
hvar = tmpvar+groupvar*.1;
vvar = ranuni(0)-.5;
output;
end;
end;
run;

symbol1 i=needle v=none w=1 color=red;
symbol2 i=needle v=none w=1 color=red;
symbol3 i=needle v=none w=32 color=blue;

options orientation = landscape
papersize = letter;

ods trace on;

ods select Gplot;

ods pdf file="histogram.pdf";
proc gplot data= a;
plot vvar*hvar=groupvar;
run;
quit;
ods pdf close;

Having run this with different widths in the symbol statements, it
seems that the only combination that yields a thin horizontal line at
zero is the one with w=1 in symbol1 and symbol2. For instance,

symbol1 i=needle v=none w=1 color=red;
symbol2 i=needle v=none w=32 color=red;
symbol3 i=needle v=none w=32 color=blue;

or

symbol1 i=needle v=none w=1 color=red;
symbol2 i=needle v=none w=32 color=red;
symbol3 i=needle v=none w=1 color=blue;

would yield a thick horizontal line. Any insight into the mapping of
needle width into horizontal line width would be much appreciated.

Thanks
Soeren