R/H axis suddenly disappeared
Dave Horsfall <[email protected]>
| Newsgroups | gmane.comp.graphics.gnuplot.user |
|---|---|
| Message-ID | <[email protected]> |
Gnuplot 5.4 patchlevel 1 on MacBook Pro Sierra 10.12.6 (updated each
week).
On 1st February (I don't know whether the date is significant) my daily
health plot suddenly lost its R/H axis. I didn't do nuffink...
Well, there was a MacPorts update that morning, but I didn't see Gnuplot
in the list; I guess it's possible that something got borked, but just the
R/H axis? Gnuplot was last updated on 25th Jan, and worked up until now.
As it was on 31st Jan: http://www.horsfall.org/health.pdf.old (no HTTPS
yet).
Now: http://www.horsfall.org/health.pdf
Well, all I did was to add an entry for 1st Feb:
# Date Time Wgt Gth Sys Dia HR
30/1/21 1800 89.9 109 115 72 77
31/1/21 1730 88.6 109 118 72 95
==> 1/2/21 1830 88.6 109 115 67 82
2/2/21 1730 90.3 109 118 60 69
The error:
gnuplot> load 'health.gp'
"health.gp" line 99: warning: y2 axis range undefined or overflow
Note that line 99 is actually the last continued line of the "plot"
command, which I certainly had not changed:
mackie:health dave$ ls -l *.gp
-rw-r--r-- 1 dave staff 5511 Sep 27 2019 health.gp
(Note that the one I attached has potentially sensitive comments removed;
it's my personal information, after all, but I'm willing to share the lot
with an individual, not the entire list.)
It's worth noting that the plot has probably saved my life a few times, as
I suffer from hypertension (with medication)...
The script itself is attached (I trust that it's within the guidelines).
Thanks.
-- Dave
_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
health.gp
(text/plain, 2.7 KB)
#
# Daily elf-check readings for weight/BP etc
#
reset # I may have been stuffing around interactively
set title "Dave's Daily Health Checks"
#
# Futz around with the legend a bit.
#
set key reverse Left
set key box outside
set key below
set terminal aqua title "health" # Why can't I just say "+title"?
#
# BMI stuff (kg/m^2).
#
#height = 182 # A bit over 6ft - must check
height = 180 # I seem to have shrunk? Damn!
bmi(weight) = weight/((height/100.0)**2)
#
# Basal metabolic rate (BMR). For men, the BMR was 66 + (13.7xW) +
# (5xH) – (6.8 x A). W is the person’s weight in kilograms, H is the
# person’s height in centimeters, and A is the person’s age in years.
# It's changed a bit... Anyway, it's kcal(Cal)/day. NB: males only.
#
# Consider using kilojoules instead (a MJ is 239kcal).
#
year = `date +%Y` # Tiny chance of wrap-around here; not worth fixing
month = `date +%-m` # Rampant octal brain-death...
age = int(year - 1952 + (month-10)/12.0 + 0.5) # XXX Wraps around in Jan! Need + 12 mod 12
bmr1(weight) = ((13.7*weight) + (5.0*height) - (6.8*age) + 66) # Orig H-B
bmr2(weight) = ((13.4*weight) + (4.8*height) - (5.7*age) + 88) # Rev H-B
# This one is now in vogue; all pretty much the same anyway...
bmr3(weight) = ((10.0*weight) + (6.3*height) - (5.0*age) + 5) # M StJ
#
# Funcs not defined but ought to be.
#
avg(a, b) = (a + b)/2.0 # Pedantically "arithmetic mean"...
#
# Useful macros.
#
WEIGHT = "$3"
GIRTH = "$4"
SYS = "$5"
DIA = "$6"
HR = "$7"
### XXX set datafile missing "x"
set style data lines # NB: needs to be explicit with user funcs
set xdata time
set timefmt "%d/%m/%y"
set xtics format "%d %b\n%Y"
set xtics nomirror
# XXX Need to get colours right
set ytics add ("(HR max) 100" 100)
set ytics add ("(HR min) 60" 60)
set ytics add ("(BMI max) 30" 30)
set ytics add ("(BMI min) 20" 20)
set y2tics add ("140 (Sys max)" 140)
set y2tics add ("100 (Sys min)" 100)
set y2tics add ("90 (Dia max)" 90)
set y2tics add ("60 (Dia min)" 60)
set yrange [0:160]
set grid # XXX And don't draw extra grid line
datafile = "health.dat"
#
# There is no correlation with time, but BP & HR is interesting.
#
#
# Legend jiggered to correspond with plots.
#
plot \
datafile using 1:(@SYS) lt rgb "red" title 'Systolic', \
datafile using 1:(@DIA) lt rgb "red" title 'Diastolic', \
datafile using 1:(@HR) with lines lt rgb "green" title 'Heart', \
datafile using 1:(@WEIGHT) with lines lt rgb "cyan" title 'Weight', \
datafile using 1:(bmi(@WEIGHT)) \
with lines lt 13 title 'BMI (kg/m^2)', \
datafile using 1:(bmr3(@WEIGHT))/100.0 \
with lines lt 3 title 'BMR/100 (Cal/day)', \
0 lt -1 notitle # Dummy so I can move above around