health-template/example.org

6.2 KiB

(save-excursion
  (let ((old-value org-confirm-babel-evaluate))
    (setq org-confirm-babel-evaluate nil)
    (org-update-all-dblocks)
    (org-show-all)
    (org-next-block 1)
    (org-babel-execute-src-block)
    (setq org-confirm-babel-evaluate old-value)))
(setq org-capture-templates '(("j" "Journal" entry (file+headline "~/tracking/tracking.org" "Journal")
"* %t
:PROPERTIES:
:exercise: 
:sleep: 
:nicotine: 
:distress: 
:pain:
:END:
")))
# clear graphics from any previous run
reset

# define output parameters
set terminal svg font "Arial" size 900,900
set output './test.svg'

# use org-mode format for input
set datafile separator "\t"
set timefmt "%Y-%m-%d"

# set up for time series data
set xdata time
set x2tics 1 format '' scale 0

# one X tick per day
set xtics 24*60*60

# vertical line on each day
set grid xtics

# one Y tick every five points
set ytics 5

# rotate labels to fit better
set xtics rotate by 60 right

set key box lc 'gray60'
set xtics format "%a %m/%d"
set yrange [0:30]
set linetype 1 lw 2 lc rgb 'forest-green' ps 1 pt 9 
set linetype 2 lw 2 lc rgb 'purple' ps 1 pt 1 
set linetype 3 lw 2 lc rgb 'dark-yellow' ps 1 pt 1 
set linetype 4 lw 2 lc rgb 'dark-pink' ps 1 pt 1 
set linetype 5 lw 2 lc rgb 'orange' ps 1 pt 1 
set linetype 6 lw 1 lc rgb 'forest-green'
set arrow 6 from graph 0, first 20 to graph 1, first 20 lt 6 dt '..'
set label "20" at graph 0.52, first 20 font 'Arial,16' tc rgb 'forest-green'
set linetype 7 lw 1 lc rgb 'purple'
set arrow 7 from graph 0, first 8 to graph 1, first 8 lt 7 dt '..'
set label "8" at graph 0.52, first 8 font 'Arial,16' tc rgb 'purple'
set linetype 8 lw 1 lc rgb 'dark-yellow'
set arrow 8 from graph 0, first 5 to graph 1, first 5 lt 8 dt '..'
set label "5" at graph 0.52, first 5 font 'Arial,16' tc rgb 'dark-yellow'
plot data using 1:($2 == 0 ? NaN : $2) with points title 'exercise (minutes)' lt 1, \
data using 1:3 with lines title 'sleep (hours)' lt 2, \
data using 1:4 with lines title 'nicotine (doses)' lt 3, \
data using 1:5 with lines title 'distress (scale)' lt 4, \
data using 1:6 with lines title 'pain (scale)' lt 5

Data table

Date exercise minutes sleep hours nicotine doses distress pain tags
[2022-09-30 Fri] 20 6 4 4 2
[2022-10-01 Sat] 10 7.5 6 3 2
[2022-10-02 Sun] 15 8 7 2 2
[2022-10-03 Mon] 0 6 5 2 2
[2022-10-04 Tue] 0 8.5 5 4 2
[2022-10-05 Wed] 15 8 5 4 2
[2022-10-06 Thu] 25 8.5 5 4 2
[2022-10-07 Fri] 25 6 5 3 2
[2022-10-08 Sat] 20 9 0 3 2
[2022-10-09 Sun] 0 6 3 4 2
[2022-10-10 Mon] 0 6 5 5 2
[2022-10-11 Tue] 0 6.5 4 4 2
[2022-10-12 Wed] 0 3 0 3 2
[2022-10-13 Thu] 0 4.5 0 3 3
[2022-10-14 Fri] 0 4 0 3 3
[2022-10-15 Sat] 0 5 0 3 2
[2022-10-16 Sun] 0 2 0 4 1
[2022-10-17 Mon] 0 4.5 0 3 2

Journal

<2022-09-30 Fri>

<2022-10-01 Sat>

<2022-10-02 Sun>

<2022-10-03 Mon>

<2022-10-04 Tue>

<2022-10-05 Wed>

<2022-10-06 Thu>

<2022-10-07 Fri>

<2022-10-08 Sat>

<2022-10-09 Sun>

<2022-10-10 Mon>

<2022-10-11 Tue>

<2022-10-12 Wed>

<2022-10-13 Thu>

<2022-10-14 Fri>

<2022-10-15 Sat>

<2022-10-16 Sun>

<2022-10-17 Mon>