diff --git a/example.org b/example.org index 222a7e7..07164bc 100644 --- a/example.org +++ b/example.org @@ -10,6 +10,7 @@ #+end_src + #+begin_src elisp (setq org-capture-templates '(("j" "Journal" entry (file+headline "~/tracking/tracking.org" "Journal") "* %t @@ -18,18 +19,20 @@ :sleep: :nicotine: :distress: +:missed: :pain: :END: "))) #+end_src + #+begin_src gnuplot :var data=mydata # clear graphics from any previous run reset # define output parameters set terminal svg font "Arial" size 900,900 -set output './test.svg' +set output './example.svg' # use org-mode format for input set datafile separator "\t" @@ -53,61 +56,65 @@ set xtics rotate by 60 right set key box lc 'gray60' set xtics format "%a %m/%d" -set yrange [0:30] +set yrange [0:40] 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 linetype 5 lw 2 lc rgb 'red' ps 1 pt 11 +set linetype 6 lw 2 lc rgb 'orange' ps 1 pt 1 +set linetype 7 lw 1 lc rgb 'forest-green' +set arrow 7 from graph 0, first 20 to graph 1, first 20 lt 7 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 linetype 8 lw 1 lc rgb 'purple' +set arrow 8 from graph 0, first 8 to graph 1, first 8 lt 8 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 linetype 9 lw 1 lc rgb 'dark-yellow' +set arrow 9 from graph 0, first 5 to graph 1, first 5 lt 9 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 using 1:($6 == 0 ? NaN : $6) with points title 'missed (doses)' lt 5, \ +data using 1:7 with lines title 'pain (scale)' lt 6 #+end_src #+RESULTS: -* Data table + #+BEGIN: columnview :hlines 1 :id myid #+tblname: mydata -| 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 | | +| Date | exercise minutes | sleep hours | nicotine doses | distress scale | missed doses | pain scale | +|------------------+------------------+-------------+----------------+----------------+--------------+------------| +| | | | | | | | +| [2022-09-30 Fri] | 20 | 6 | 4 | 4 | 0 | 2 | +| [2022-10-01 Sat] | 10 | 7.5 | 6 | 3 | 0 | 2 | +| [2022-10-02 Sun] | 15 | 8 | 7 | 2 | 0 | 2 | +| [2022-10-03 Mon] | 0 | 6 | 5 | 2 | 0 | 2 | +| [2022-10-04 Tue] | 0 | 8.5 | 5 | 4 | 0 | 2 | +| [2022-10-05 Wed] | 15 | 8 | 5 | 4 | 0 | 2 | +| [2022-10-06 Thu] | 25 | 8.5 | 5 | 4 | 0 | 2 | +| [2022-10-07 Fri] | 25 | 6 | 5 | 3 | 0 | 2 | +| [2022-10-08 Sat] | 20 | 9 | 0 | 3 | 0 | 2 | +| [2022-10-09 Sun] | 0 | 6 | 3 | 4 | 0 | 2 | +| [2022-10-10 Mon] | 0 | 6 | 5 | 5 | 0 | 2 | +| [2022-10-11 Tue] | 0 | 6.5 | 4 | 4 | 0 | 2 | +| [2022-10-12 Wed] | 0 | 3 | 0 | 3 | 0 | 2 | +| [2022-10-13 Thu] | 0 | 4.5 | 0 | 3 | 0 | 3 | +| [2022-10-14 Fri] | 0 | 4 | 0 | 3 | 1 | 3 | +| [2022-10-15 Sat] | 0 | 5 | 0 | 3 | 0 | 2 | +| [2022-10-16 Sun] | 0 | 2 | 0 | 4 | 0 | 1 | +| [2022-10-17 Mon] | 0 | 4.5 | 0 | 3 | 0 | 2 | #+END: -* Journal - :PROPERTIES: - :columns: %timestamp(Date) %exercise(exercise minutes) %sleep(sleep hours) %nicotine(nicotine doses) %distress(distress) %pain(pain) %TAGS(tags) - :ID: myid - :END: + +* Journal + :PROPERTIES: + :columns: %timestamp(Date) %exercise(exercise minutes) %sleep(sleep hours) %nicotine(nicotine doses) %distress(distress scale) %missed(missed doses) %pain(pain scale) +:ID: myid +:END: + ** <2022-09-30 Fri> :PROPERTIES: @@ -116,6 +123,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 4 :distress: 4 :pain: 2 +:missed: 0 :END: ** <2022-10-01 Sat> :PROPERTIES: @@ -124,6 +132,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 6 :distress: 3 :pain: 2 +:missed: 0 :END: ** <2022-10-02 Sun> @@ -133,6 +142,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 7 :distress: 2 :pain: 2 +:missed: 0 :END: ** <2022-10-03 Mon> @@ -142,6 +152,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 5 :distress: 2 :pain: 2 +:missed: 0 :END: ** <2022-10-04 Tue> :PROPERTIES: @@ -150,6 +161,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 5 :distress: 4 :pain: 2 +:missed: 0 :END: ** <2022-10-05 Wed> :PROPERTIES: @@ -158,6 +170,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 5 :distress: 4 :pain: 2 +:missed: 0 :END: ** <2022-10-06 Thu> :PROPERTIES: @@ -166,6 +179,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 5 :distress: 4 :pain: 2 +:missed: 0 :END: ** <2022-10-07 Fri> :PROPERTIES: @@ -174,6 +188,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 5 :distress: 3 :pain: 2 +:missed: 0 :END: ** <2022-10-08 Sat> :PROPERTIES: @@ -182,6 +197,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 0 :distress: 3 :pain: 2 +:missed: 0 :END: ** <2022-10-09 Sun> :PROPERTIES: @@ -191,6 +207,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :distress: 4 :pain: 2 :meditation: 0 +:missed: 0 :END: ** <2022-10-10 Mon> :PROPERTIES: @@ -199,6 +216,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 5 :distress: 5 :pain: 2 +:missed: 0 :END: ** <2022-10-11 Tue> :PROPERTIES: @@ -207,6 +225,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 4 :distress: 4 :pain: 2 +:missed: 0 :END: ** <2022-10-12 Wed> :PROPERTIES: @@ -215,6 +234,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 0 :distress: 3 :pain: 2 +:missed: 0 :END: ** <2022-10-13 Thu> :PROPERTIES: @@ -223,6 +243,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 0 :distress: 3 :pain: 3 +:missed: 0 :END: ** <2022-10-14 Fri> :PROPERTIES: @@ -231,6 +252,7 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 0 :distress: 3 :pain: 3 +:missed: 1 :END: ** <2022-10-15 Sat> :PROPERTIES: @@ -239,26 +261,23 @@ data using 1:6 with lines title 'pain (scale)' lt 5 :nicotine: 0 :distress: 3 :pain: 2 +:missed: 0 :END: ** <2022-10-16 Sun> :PROPERTIES: :exercise: 0 :sleep: 2 -:adl: 1 :nicotine: 0 :distress: 4 :missed: 0 :pain: 1 -:meditation: 0 :END: ** <2022-10-17 Mon> :PROPERTIES: :exercise: 0 :sleep: 4.5 -:adl: 1 :nicotine: 0 :distress: 3 :missed: 0 :pain: 2 -:meditation: 0 :END: diff --git a/example.svg b/example.svg new file mode 100644 index 0000000..ee7002b --- /dev/null +++ b/example.svg @@ -0,0 +1,447 @@ + + + +Gnuplot +Produced by GNUPLOT 5.4 patchlevel 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 5 + + + + + 10 + + + + + 15 + + + + + 20 + + + + + 25 + + + + + 30 + + + + + 35 + + + + + 40 + + + + + + + + + + + + + Fri 09/30 + + + + + + + + + + + + + Sat 10/01 + + + + + + + + + + + + + Sun 10/02 + + + + + + + + + + + + + Mon 10/03 + + + + + + + + + + + + + Tue 10/04 + + + + + + + + + + + + + Wed 10/05 + + + + + + + + + + + + + Thu 10/06 + + + + + + + + + + + + + Fri 10/07 + + + + + + + + + + + + + Sat 10/08 + + + + + + + + + + + + + Sun 10/09 + + + + + + + + + + + + + Mon 10/10 + + + + + + + + + + + + + Tue 10/11 + + + + + + + + + + + + + Wed 10/12 + + + + + + + + + + + + + Thu 10/13 + + + + + + + + + + + + + Fri 10/14 + + + + + + + + + + + + + Sat 10/15 + + + + + + + + + + + + + Sun 10/16 + + + + + + + + + + + + + Mon 10/17 + + + + + + + 20 + + + 8 + + + 5 + + + + + + + + + + + + + exercise (minutes) + + + + + exercise (minutes) + + + + + + + + + + + + + + sleep (hours) + + + sleep (hours) + + + + + + nicotine (doses) + + + nicotine (doses) + + + + + + distress (scale) + + + distress (scale) + + + + + + missed (doses) + + + missed (doses) + + + + + + + + pain (scale) + + + pain (scale) + + + + + + + + + + + + + + + + diff --git a/health-template.el b/health-template.el index 7cf2c3c..1981caa 100644 --- a/health-template.el +++ b/health-template.el @@ -198,6 +198,7 @@ set label \"%d\" at graph 0.52, first %d font 'Arial,16' tc rgb '%s'\n" (:name "sleep" :goal 8 :unit :hours :color "purple" :thickness 2 :plot-type :lines) (:name "nicotine" :goal 5 :unit :doses :color "dark-yellow" :thickness 2 :plot-type :lines) (:name "distress" :unit :scale :color "dark-pink" :thickness 2 :plot-type :lines) + (:name "missed" :unit :doses :color "red" :thickness 2 :plot-type :points :point-type 11) (:name "pain" :unit :scale :color "orange" :thickness 2 :plot-type :lines)))) ;; (health-generate-org-template) diff --git a/test.svg b/test.svg index 8aa8561..ee7002b 100644 --- a/test.svg +++ b/test.svg @@ -47,35 +47,45 @@ - + 5 - + 10 - + 15 - + 20 - + 25 - + 30 + + + 35 + + + + + 40 + + @@ -263,7 +273,7 @@ - + @@ -277,7 +287,7 @@ - + @@ -291,7 +301,7 @@ - + @@ -305,7 +315,7 @@ - + @@ -330,26 +340,26 @@ - + 20 - + 8 - + 5 - + - + - + - + exercise (minutes) @@ -359,13 +369,13 @@ - - - - - - - + + + + + + + @@ -376,9 +386,9 @@ - + nicotine (doses) @@ -387,8 +397,8 @@ - distress (scale) @@ -398,20 +408,31 @@ - + - pain (scale) + missed (doses) + missed (doses) + + + + + + + + pain (scale) + + pain (scale) - +