|
DUMBBELL PLOTName:
The appearance of the plot is controlled by the first four settings of the LINE and CHARACTER commands (and the associated attribute setting commands). Specifically, given the paired variables Y1 and Y2
This is demonstrated in the Program example below. Note that dumbbell plots are often drawn horizontally rather than vertically. This can be controlled with the HORIZONTAL SWITCH command.
where <y1> is the first response variable; <y2> is the second response variable; and where the <SUBSET/EXCEPT/FOR qualification> is optional. For this syntax, the x-axis value is simply the sequence number.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the first response variable; <y2> is the second response variable; <x> is the horizontal axis variable; and where the <SUBSET/EXCEPT/FOR qualification> is optional.
DUMBBELL PLOT Y1 Y2 X DUMBBELL PLOT Y1 Y2 SUBSET Y1 > 0 SUBSET Y2 > 0
. Step 1: Create some data - from
. https://inforiver.com/insights/dumbbell-charts-game-changer/
.
read gdp2021 gdp2022
4.60 4.70
6.20 2.40
4.20 2.20
3.80 5.10
5.70 1.60
6.80 2.50
7.40 3.60
4.90 6.20
1.50 2.80
3.00 2.10
end of data
.
let string s1 = Austria
let string s2 = Belgium
let string s3 = Switzerland
let string s4 = UAE
let string s5 = United States
let string s6 = France
let string s7 = United Kingdom
let string s8 = Portugal
let string s9 = Thailand
let string s10 = Finland
let ig = group label s1 to s10
.
. Step 2: Define some plot control
.
title case asis
label case asis
tic mark label case asis
.
let n = size gdp2021
ylimits 1 n
major ytic mark number n
minor ytic mark number 0
tic mark offset units data
ytic mark offset 0.5 0.5
y1tic mark label format group label
y1tic mark label content ig
.
line blank blank solid solid
line thickness 0.3 all
line color black black red blue
character circle circle blank blank
character hw 1.0 0.75 all
character fill on on off off
character color red blue black black
.
. Step 3: Generate the plot
.
horizontal switch on
title GDP Growth Rate for 2021 and 2022
dumbbell plot gdp2021 gdp2022
Program 2:
. Step 1: Read data
.
skip 25
read elkins11.dat x y1 y2 y3
let x = int(x)
set let cross tabulate collapse
let y1min = cross tabulate minimum y1 x
let y1max = cross tabulate maximum y1 x
let xt = cross tabulate group one x
.
. Step 2: Define some plot control
.
title case asis
label case asis
tic mark label case asis
.
let n = size xt
loop for k = 1 1 n
let xval = xt(k)
let string s^k = ^xval
let xt2(k) = ^k
end of loop
let ig = group label s1 to s^n
ylimits 1 n
major ytic mark number n
minor ytic mark number 0
tic mark offset units data
ytic mark offset 0.5 0.5
y1label Year
y1tic mark label format group label
y1tic mark label content ig
x1label Freon-11 Concentration (parts per trillion)
xlimits 100 300
.
bar on all
bar off off
bar width 0.8 all
bar fill on all
bar color blue all
line blank all
.
. Step 3: Generate the plot
.
horizontal switch on
title Range Bar Chart of Freon-11 Concentration
dumbbell plot y1min y1max
Date created: 05/22/2025 |
Last updated: 06/26/2025 Please email comments on this WWW page to [email protected]. | |||||||||||||||||||