|
VARIABLE WIDTH BAR PLOTName:
Optionally, an additional tag variable can be specified. Rows that have the same value for the tag variable will use the same attributes for the bars. The lowest value of the tag variable will use the first setting of the BAR attribute commands, the second lowest value will use the second setting of the BAR attribute commands and so on. This is most typically used to control the color of the bars. If no tag variable is specified, then all bars will be drawn with the same attributes.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the variable that controls the height of the bar; <y2> is the variable that controls the width of the bar; and where the <SUBSET/EXCEPT/FOR qualification> is optional. With this syntax, all bars will be drawn with the same attributes. The <y1> and <y2> variables must have the same number of observations.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the variable that controls the height of the bar; <y2> is the variable that controls the width of the bar; <tag> is a variable that specifies which bars are drawn with the same attributes; and where the <SUBSET/EXCEPT/FOR qualification> is optional. With this syntax, bars that have the same value for the <tag> variable will be drawn with the same attributes. Most typically, this is used to specify the fill color for the bars. The <y1>, <y2> and <tag> variables must have the same number of observations. The use of the <tag> variable is demonstrated in the Program example below.
VARIABLE WIDTH BAR PLOT Y1 Y2 TAG VARIABLE WIDTH BAR PLOT Y1 Y2 SUBSET Y2 > 0
To set this option, enter the command
The default is OFF (i.e., option 1).
skip 25
column limits 1 29
read subject.dat number perwomen type
skip 0
let n = size number
column limits 30 80
loop for k = 1 1 n
let irow = 25 + k
row limits irow irow
read string subject.dat subj^k
end of loop
column limits
row limits
let ig = group label subj1 to subj^n
.
. Step 2: Set some plot control
.
case asis
title case asis
label case asis
tic mark label case asis
.
horizontal switch on
ylimits 1 n
major y1tic mark number n
minor y1tic mark number 0
tic mark offset units data
y1tic mark offset 0.8 0.8
y1tic mark label format group label
y1tic mark label content ig
y1label Subject
y1label displacement 21
.
x1limits 0 15000
x1label Number of Entrants
x2label Width of Bar: Percentage of Women
x3label Blue: Theoretical Subject, Red: Vocational Subject
.
frame corner coordinate 25 20 95 90
title Variable Width Bar Chart
bar fill color blue red
.
. Step 3: Generate the plot
.
set variable width bar plot connected off
variable width bar plot number perwomen type
.
. Step 4: Now generate with "connected" option ON
.
ylimits 1 n
major y1tic mark number n
minor y1tic mark number 0
tic mark offset units data
y1tic mark offset 1.0 2.2
y1tic marks off
y1tic mark labels off
.
set variable width bar plot connected on
variable width bar plot number perwomen type
.
. Now generate the y-axis tic mark labels
.
justification rice
let xcoor = 23
.
loop for k = 1 1 n
let ycoor = xplot(k)
movesd xcoor ycoor
text ^subj^k
end of loop
Date created: 06/30/2025 |
Last updated: 06/30/2025 Please email comments on this WWW page to [email protected]. | |||||||||||||||||||||||||