.PAPER SIZE 58,80
.RIGHT MARGIN 80
.FIGURE 5
.CENTER
Modifying VAX-DTR Plots
.TITLE Modifying VAX-DTR Plots
.SUBTITLE B.#Z.#Lederman
.PARAGRAPH
I had some data which I wanted to plot in Datatrieve. It happened that the data
was best displayed with the X (horizontal) axis linear, and the Y (vertical)
axis Logarithmic: in addition, I wanted several variables plotted together. I
found that Datatrieve would plot the proper axis (X__LOGY), or several
variables (MULTI__LINE), but not multiple lines with Log Y. I was able to add
this plot relatively easily by comparing plots X__Y and X__LOGY, and
transposing the differences into a copy of MULTI__LINE.
.PARAGRAPH
The first step in adding a plot is to extract the old plot used as a template,
and then re-name it so it won't replace the original (people might still be
using it, and they'll get upset if it disappears). I called my version
MULTI__LOGY, and it is as follows:
.BLANK.NO JUSTIFY.NO FILL
DELETE MULTI__LOGY;
REDEFINE PLOT MULTI__LOGY
!
! Created by B. Z. Lederman by modifying DTR plots.
!
! This plot is used in exactly the same manner as MULTI__LINE,
! with the same input variables. The only difference is that
! the Y-axis is logarithmic rather than linear.
!
DECLARE X__REF, X__LENGTH, X__MIN, X__MAX
DECLARE Y__REF, Y__LENGTH, Y__MIN__VALUE, Y__MAX__VALUE, D__LABEL
DECLARE I,J,K,N, COUNT, MX, WIDTH
DECLARE VECTOR X, Y1, Y2, Y3, Y__MIN, Y__MAX, Y__MX, COLOR
DECLARE STRING VECTOR Y__LABEL, CHR
ENTRY 0 (X__LABEL : STRING,
LABEL__1 : STRING,
LABEL__2 : STRING,
LABEL__3 : STRING)
BEGIN
PLOT HOUSEKEEP 0
SET_SEGMENT 0
PRINT 'L(A2)'
PRINT 'L"5"00FF8181818181FF'
PRINT 'L"6"0018244281422418'
PRINT 'L"0"00FF814242242418'
OUTPUT_SEGMENT 0
SET_SEGMENT 1
X__REF = 100 Y__REF = 360 X__LENGTH = 600 Y__LENGTH = 350
PLOT LABEL 0 (X__REF, Y__REF, X__LENGTH, Y__LENGTH, X__LABEL, D__LABEL)
!
! One could probably change the symbol and color mappings here.
!
CHR(1) = '6' COLOR(1) = 1 Y__LABEL(1) = LABEL__1
CHR(2) = '5' COLOR(2) = 2 Y__LABEL(2) = LABEL__2
CHR(3) = '0' COLOR(3) = 3 Y__LABEL(3) = LABEL__3
INCR I OVER Y__LABEL
IF LENGTH(Y__LABEL(I)) NE 0 THEN
COUNT = COUNT + 1
END
ENTRY 1 (X__VALUE, Y1__VALUE, Y2__VALUE, Y3__VALUE)
BEGIN
X(SIZE(X)+1) = X__VALUE
!
! The next three lines are changed so that the log is
! taken of the input Y-axis data.
!
Y1(SIZE(Y1)+1) = LOG (Y1__VALUE)
Y2(SIZE(Y2)+1) = LOG (Y2__VALUE)
Y3(SIZE(Y3)+1) = LOG (Y3__VALUE)
END
ENTRY 2
BEGIN
Y__MIN(1) = MIN(Y1) Y__MIN(2) = MIN(Y2) Y__MIN(3) = MIN(Y3)
Y__MAX(1) = MAX(Y1) Y__MAX(2) = MAX(Y2) Y__MAX(3) = MAX(Y3)
Y__MIN__VALUE = MIN(Y__MIN)
Y__MAX__VALUE = MAX(Y__MAX)
PLOT LABEL 5 (Y__MIN__VALUE, Y__MAX__VALUE) ! vice label 3
X__MIN = MIN(X)
X__MAX = MAX(X)
PLOT LABEL 2 (X__MIN, X__MAX, X)
SORT(X, Y1, Y2, Y3)
PRINT 'T(BA2S[8,16])'
IF COUNT GE 1 THEN
PLOT MULTI__LOGY 3 (Y1)
IF COUNT GE 2 THEN
PLOT MULTI__LOGY 3 (Y2)
IF COUNT GE 3 THEN
PLOT MULTI__LOGY 3 (Y3)
PRINT 'T(E)'
WIDTH = X__LENGTH / 30
Y__MX(30) = 0
INCR I OVER X
BEGIN
Y__MIN(1) = Y1(I) Y__MIN(2) = Y2(I) Y__MIN(3) = Y3(I)
MX = MIN(Y__MIN)
J = ((X(I) - X__REF) / WIDTH) + 1
Y__MX(J) = 1000
IF Y__MX(J) GT MX THEN
Y__MX(J) = MX
END
INCR I OVER Y__MX
IF (I NE 1) AND (Y__MX(I) EQ 0) THEN
Y__MX(I) = Y__MX(I -1)
OUTPUT_SEGMENT 1
PLOT LEGEND 4 (X__REF,Y__REF,X__LENGTH,Y__LENGTH,WIDTH,Y__MX,CHR,COLOR,Y__LABEL)
PLOT HOUSEKEEP 2
END
ENTRY 3 (Y : VECTOR)
BEGIN
PLOT LABEL 8 (Y)
N = N + 1
PRINT 'P', LXY(X(1), Y(1)), 'W(I', CVT(COLOR(N)), ')'
INCR I OVER X
PRINT 'V', LXY(X(I), Y(I))
PRINT 'W(R)'
INCR I OVER X
PRINT 'p', LXY(X(I)-4, Y(I)-10), 't', QUOTE(CHR(N))
PRINT 'W(V)'
END
END__PLOT
.BLANK.JUSTIFY.FILL
One change not immediately obvious is in the next to last PRINT statement: the
literals 'p' and 't' are lower case: I found this to be necessary for the
graph to come out properly. The LABEL#ENTRY change from 3 to 5 was also found
to be necessary for the Y-axis to be labeled in the normal Log scale:
otherwise, the exponent of the scale value is printed linearly (this might be
useful to some people). If you want to use this plot, you will probably find it
easier to extract MULTI__LINE and edit it rather than typing in the entire plot
as printed here.
.PARAGRAPH
I also made an almost identical plot, MULTI__LOGY__LR, which is used in the
same manner as MULTI__LOGY. The only difference is that the points are not
connected: rather, a linear regression line (best fit to the data) is drawn for
each Y-axis variable.
.BLANK.NO JUSTIFY.NO FILL
DELETE MULTI__LOGY__LR;
REDEFINE PLOT MULTI__LOGY__LR
!
! This plot modified by B. Z. Lederman from MULTI__LOGY
!
! It is used in exactly the same way, but it plots the Linear
! Regression (best fit) line rather than connecting the data points.
!
DECLARE X__REF, X__LENGTH, X__MIN, X__MAX
DECLARE Y__REF, Y__LENGTH, Y__MIN__VALUE, Y__MAX__VALUE, D__LABEL
DECLARE I,J,K,N, COUNT, MX, WIDTH
DECLARE VECTOR X, Y1, Y2, Y3, Y__MIN, Y__MAX, Y__MX, COLOR
DECLARE STRING VECTOR Y__LABEL, CHR
ENTRY 0 (X__LABEL : STRING,
LABEL__1 : STRING,
LABEL__2 : STRING,
LABEL__3 : STRING)
BEGIN
PLOT HOUSEKEEP 0
SET_SEGMENT 0
PRINT 'L(A2)'
PRINT 'L"5"00FF8181818181FF'
PRINT 'L"6"0018244281422418'
PRINT 'L"0"00FF814242242418'
OUTPUT_SEGMENT 0
SET_SEGMENT 1
X__REF = 100 Y__REF = 360 X__LENGTH = 600 Y__LENGTH = 350
PLOT LABEL 0 (X__REF, Y__REF, X__LENGTH, Y__LENGTH, X__LABEL, D__LABEL)
CHR(1) = '6' COLOR(1) = 1 Y__LABEL(1) = LABEL__1
CHR(2) = '5' COLOR(2) = 2 Y__LABEL(2) = LABEL__2
CHR(3) = '0' COLOR(3) = 3 Y__LABEL(3) = LABEL__3
INCR I OVER Y__LABEL
IF LENGTH(Y__LABEL(I)) NE 0 THEN
COUNT = COUNT + 1
END
ENTRY 1 (X__VALUE, Y1__VALUE, Y2__VALUE, Y3__VALUE)
BEGIN
X(SIZE(X)+1) = X__VALUE
Y1(SIZE(Y1)+1) = LOG (Y1__VALUE) ! Note LOG value
Y2(SIZE(Y2)+1) = LOG (Y2__VALUE)
Y3(SIZE(Y3)+1) = LOG (Y3__VALUE)
END
ENTRY 2
BEGIN
Y__MIN(1) = MIN(Y1) Y__MIN(2) = MIN(Y2) Y__MIN(3) = MIN(Y3)
Y__MAX(1) = MAX(Y1) Y__MAX(2) = MAX(Y2) Y__MAX(3) = MAX(Y3)
Y__MIN__VALUE = MIN(Y__MIN)
Y__MAX__VALUE = MAX(Y__MAX)
PLOT LABEL 5 (Y__MIN__VALUE, Y__MAX__VALUE) ! vice 3
X__MIN = MIN(X)
X__MAX = MAX(X)
PLOT LABEL 2 (X__MIN, X__MAX, X)
PRINT 'T(BA2S[8,16])'
N = 0
IF COUNT GE 1 THEN
PLOT MULTI__LOGY__LR 3 (Y1)
IF COUNT GE 2 THEN
PLOT MULTI__LOGY__LR 3 (Y2)
IF COUNT GE 3 THEN
PLOT MULTI__LOGY__LR 3 (Y3)
PRINT 'T(E)'
WIDTH = X__LENGTH / 30
Y__MX(30) = 0
INCR I OVER X
BEGIN
Y__MIN(1) = Y1(I) Y__MIN(2) = Y2(I) Y__MIN(3) = Y3(I)
MX = MIN(Y__MIN)
J = ((X(I) - X__REF) / WIDTH) + 1
Y__MX(J) = 1000
IF Y__MX(J) GT MX THEN
Y__MX(J) = MX
END
INCR I OVER Y__MX
IF (I NE 1) AND (Y__MX(I) EQ 0) THEN
Y__MX(I) = Y__MX(I -1)
OUTPUT_SEGMENT 1
PLOT LEGEND 4 (X__REF,Y__REF,X__LENGTH,Y__LENGTH,WIDTH,Y__MX,CHR,COLOR,Y__LABEL)
PLOT HOUSEKEEP 2
END
ENTRY 3 (ARRAY : VECTOR)
BEGIN
PLOT LABEL 8 (ARRAY)
N = N + 1
PRINT 'W(RI', CVT(COLOR(N)), ')'
PLOT LABEL 7
INCR I OVER X
BEGIN
PRINT 'p', LXY(X(I)-4,ARRAY(I)-10), 't', QUOTE(CHR(N))
END
PRINT 'W(V)'
END
END__PLOT
.JUSTIFY.FILL.PARAGRAPH
Attached are two examples of both plots using some sample data. The difference
is most obvious at the top right-hand end of the "C" variable line (the topmost
data line). I have also included the same data plotted with MULTI__LINE and
MULTI__LR for comparison: it can be seen that a logarithmic graph fits this
data better than a linear graph.