Correct capacitor label

Correct capacitor label

# Gnuplot plot-generating script for ECE-L302 Lab 8
# Note that this script requires the LUA Gnuplot terminal, which is not
# distributed in all packages, and the gnuplot-lua-tikz LaTeX package to
# process it.  This can be found here:
#
# http://www.sfr-fresh.com/unix/misc/gnuplot-4.4.2.tar.gz:t/gnuplot-4.4.2/share/LaTeX/gnuplot-lua-tikz.sty
#
# Execute this script with $gnuplot plots.gp
#
# Author: Sean Barag <sjb89@drexel.edu>

set terminal tikz color solid size 4.25in,2.25in

# ---- Varying C ----
set border 15
set key center right width 1 box height 1
set log x
set xrange[0.0001:5]
set yrange[0:150]
set ytics 30
set y2range[0:55]
set y2tics auto
set title 'Free-running Oscillator: Varying Capacitor'
set xlabel 'Capacitance, $C_T$ (\si{\micro\farad})'
set ylabel 'Output Frequency, $f$ (\si{\kilo\hertz})'
set y2label 'Output Duty Cycle, (\si{\percent})'
set grid
set output "../img/plot/free_run_c.tex"
plot "free_run_c.txt" using 1:3 with linespoints axis x1y1 lw 3 pt 8 title '$f$', \
     "free_run_c.txt" using 1:4 with linespoints axis x1y2 lw 3 pt 5 title 'Duty Cycle'

# ---- Varying R ----
set key top left width 1 box height 1
unset log x
set xrange[0:20]
set xtics 2
set yrange[0:16]
set ytics 2
set y2range[0:80]
set y2tics auto
set title 'Free-running Oscillator: Varying Resistor'
set xlabel 'Resistance, $R_A$ (\si{\kilo\ohm})'
set ylabel 'Output Frequency, $f$ (\si{\kilo\hertz})'
set y2label 'Output Duty Cycle, (\si{\percent})'
set grid
set output "../img/plot/free_run_r.tex"
plot "free_run_r.txt" using 1:3 with linespoints axis x1y1 lw 3 pt 8 title '$f$', \
     "free_run_r.txt" using 1:4 with linespoints axis x1y2 lw 3 pt 5 title 'Duty Cycle'

# ---- DC sweep ----
unset key
set xrange[0:8]
set yrange[0:15]
set xtics auto
set ytics 3
unset y2range
unset y2tics
unset y2label
set grid
set title 'DC Sweep'
set xlabel 'Input Voltage, $V+$ (\si{\volt})'
set ylabel 'Output Frequency, $f$ (\si{\kilo\hertz})'
set grid
set output "../img/plot/dc_sweep.tex"
plot "dc_sweep.txt" using 1:2 with linespoints lw 3

# ---- freq mod ----
set key center right width -33 box
set xrange[0:3]
set yrange[0:25]
set xtics auto
set ytics 5
unset y2range
unset y2tics
unset y2label
set grid
set title 'Frequency Modulation'
set xlabel 'Input Frequency, $f$ (\si{\hertz})'
set ylabel 'Output Period, $\Delta t$ (\si{\micro\second})'
set grid
set output "../img/plot/freq_mod.tex"
plot "freq_mod.txt" index 0 using 1:2 with linespoints pt 8 lw 3 title '$\SI{1}{\volt}_\text{\footnotesize P-P}$',\
	 "freq_mod.txt" index 1 using 1:2 with linespoints pt 7 lw 3 title '$\SI{2}{\volt}_\text{\footnotesize P-P}$',\
	 "freq_mod.txt" index 2 using 1:2 with linespoints pt 5 lw 3 title '$\SI{3}{\volt}_\text{\footnotesize P-P}$'

# Gnuplot plot-generating script for ECE-L302 Lab 8
# Note that this script requires the LUA Gnuplot terminal, which is not
# distributed in all packages, and the gnuplot-lua-tikz LaTeX package to
# process it.  This can be found here:
#
# http://www.sfr-fresh.com/unix/misc/gnuplot-4.4.2.tar.gz:t/gnuplot-4.4.2/share/LaTeX/gnuplot-lua-tikz.sty
#
# Execute this script with $gnuplot plots.gp
#
# Author: Sean Barag <sjb89@drexel.edu>

set terminal tikz color solid size 4.25in,2.25in

# ---- Varying C ----
set border 15
set key center right width 1 box height 1
set log x
set xrange[0.0001:5]
set yrange[0:150]
set ytics 30
set y2range[0:55]
set y2tics auto
set title 'Free-running Oscillator: Varying Capacitor'
set xlabel 'Capacitance, $C_A$ (\si{\micro\farad})'
set ylabel 'Output Frequency, $f$ (\si{\kilo\hertz})'
set y2label 'Output Duty Cycle, (\si{\percent})'
set grid
set output "../img/plot/free_run_c.tex"
plot "free_run_c.txt" using 1:3 with linespoints axis x1y1 lw 3 pt 8 title '$f$', \
     "free_run_c.txt" using 1:4 with linespoints axis x1y2 lw 3 pt 5 title 'Duty Cycle'

# ---- Varying R ----
set key top left width 1 box height 1
unset log x
set xrange[0:20]
set xtics 2
set yrange[0:16]
set ytics 2
set y2range[0:80]
set y2tics auto
set title 'Free-running Oscillator: Varying Resistor'
set xlabel 'Resistance, $R_A$ (\si{\kilo\ohm})'
set ylabel 'Output Frequency, $f$ (\si{\kilo\hertz})'
set y2label 'Output Duty Cycle, (\si{\percent})'
set grid
set output "../img/plot/free_run_r.tex"
plot "free_run_r.txt" using 1:3 with linespoints axis x1y1 lw 3 pt 8 title '$f$', \
     "free_run_r.txt" using 1:4 with linespoints axis x1y2 lw 3 pt 5 title 'Duty Cycle'

# ---- DC sweep ----
unset key
set xrange[0:8]
set yrange[0:15]
set xtics auto
set ytics 3
unset y2range
unset y2tics
unset y2label
set grid
set title 'DC Sweep'
set xlabel 'Input Voltage, $V+$ (\si{\volt})'
set ylabel 'Output Frequency, $f$ (\si{\kilo\hertz})'
set grid
set output "../img/plot/dc_sweep.tex"
plot "dc_sweep.txt" using 1:2 with linespoints lw 3

# ---- freq mod ----
set key center right width -33 box
set xrange[0:3]
set yrange[0:25]
set xtics auto
set ytics 5
unset y2range
unset y2tics
unset y2label
set grid
set title 'Frequency Modulation'
set xlabel 'Input Frequency, $f$ (\si{\hertz})'
set ylabel 'Output Period, $\Delta t$ (\si{\micro\second})'
set grid
set output "../img/plot/freq_mod.tex"
plot "freq_mod.txt" index 0 using 1:2 with linespoints pt 8 lw 3 title '$\SI{1}{\volt}_\text{\footnotesize P-P}$',\
	 "freq_mod.txt" index 1 using 1:2 with linespoints pt 7 lw 3 title '$\SI{2}{\volt}_\text{\footnotesize P-P}$',\
	 "freq_mod.txt" index 2 using 1:2 with linespoints pt 5 lw 3 title '$\SI{3}{\volt}_\text{\footnotesize P-P}$'


Minor changes in plot.

Minor changes in plot.

reset # do not use any previous settings
set title "Termsuite - Keyphrase extraction" # chart title
set xlabel "wrlog filter" # x-axis label
set ylabel "Precision/Recall/f1-score" # y-axis label
set term png size 800, 500 font "Helvetica" 9
set size ratio 0.575
set output "termsuite.png" # name of image file (change to .eps for eps file)
set xtics 2.0, 0.1, 6.0 rotate by 45 offset -0.8,-0.8 # set increment for x-axis
set ytics 0.05
set grid y
set key left top
set style data linespoints # set default way of data plotting
set pointsize 1.5 # increase size of points on the line

plot "termsuite_ann.dat" using 1:2 title "precision", \
"termsuite_ann.dat" using 1:3 title "recall", \
"termsuite_ann.dat" using 1:4 title "f1-score"

reset # do not use any previous settings
set title "Termsuite - Keyphrase extraction" # chart title
set xlabel "wrlog filter" # x-axis label
set ylabel "Precision/Recall/f1-score" # y-axis label
set term png size 800, 400
set size ratio 0.4
set output "termsuite.png" # name of image file (change to .eps for eps file)
set xtics 2.0, 0.2, 6.0  # set increment for x-axis
set ytics 0.1
set key left top
set style data linespoints # set default way of data plotting
set pointsize 1.5 # increase size of points on the line

plot "termsuite_ann.dat" using 1:2 title "precision", \
"termsuite_ann.dat" using 1:3 title "recall", \
"termsuite_ann.dat" using 1:4 title "f1-score"


New keymaster rules (db_object_v descendants only)

:- begin_tests(db_i).
:- use_module(u(v)).
:- use_module(u(vd)).
:- use_module(u(internal/objects_i)).
:- use_module(u(internal/db_i)).
:- use_module(u(internal/db_vocab)).

test(db_functor_des, [setup(model_db(_))]) :-

   findall(F, db_functor_des(people, F, _, _), List1_0),
   msort(List1_0, List1),
   assertion(List1 == [callup_v, citizen_v, db_object_v, man_v]),

   findall(F,
           (F = man_v, db_functor_des(people, F, _, _)),
           List2_0),
   msort(List2_0, List2),
   assertion(List2 == [man_v]),

   findall(F,
           (F = citizen_v, db_functor_des(people, F, _, _)),
           List3_0),
   msort(List3_0, List3),
   assertion(List3 == [citizen_v]),

   findall(F,
           (F = callup_v, db_functor_des(people, F, _, _)),
           List4),
   assertion(List4 == [callup_v]).

test(db_next_class_id, [setup(setup)]) :-

	db_i:db_next_class_id(db_i_test, Id1),
	assertion(Id1 =:= 2),
	db_i:db_next_class_id(db_i_test, Id2),
	assertion(Id2 =:= 3),
	db_i:db_next_class_id(db_i_test, Id3),
	assertion(Id3 =:= 4).

% test local class id -> db class id conversion
test(db_conv_local_db1, [setup(setup)]) :-
	obj_construct(man_v, [], [], Man1),
	obj_rebase((object_v -> db_object_v), Man1, Man),
	arg(1, Man, Man_Local_Id),
	db_i:db_add_class(db_i_test, Man_Local_Id, Man_DB_Id, _),
	db_conv_local_db(db_i_test, Man_Local_Id,
			 Man_DB_Id1,_),
	assertion(Man_DB_Id =:= Man_DB_Id1).

test(db_conv_local_db2, [setup(setup), fail]) :-
        % object_v
	class_id(Object_Local_Id, object_v), !,
	db_conv_local_db(db_i_test, Object_Local_Id,
			 _, _).

test(db_conv_local_db3, [setup(setup), fail]) :-
        % not db_object_v descendant
	class_primary_id(man_v, Object_Local_Id), !,
	db_conv_local_db(db_i_test, Object_Local_Id,
			 _, _).

test(db_key_policy, [setup(setup)]) :-

   db_key_policy(db_i_test, Old1, New1),
   assertion(Old1 == throw),
   assertion(New1 == throw),

   db_key_policy(db_i_test, Old2, overwrite),
   assertion(Old2 == throw),

   db_key_policy(db_i_test, _, overwrite),
   db_key_policy(db_i_test, overwrite, _),
   db_key_policy(db_i_test, overwrite, overwrite),

   db_key_policy(db_i_test, overwrite, throw),

   db_key_policy(db_i_test, Old3, New3),
   assertion(Old3 == throw),
   assertion(New3 == throw).

test(db_recorded_int1,
     [setup(setup),
      error(domain_error(db_object_v_descendant, Obj0))]
    ) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   db_put_object(db_i_test, Obj0, _),
   db_recorded_int(db_i_test, Obj0).

test(db_recorded_int2, [setup(setup)]) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   db_put_object(db_i_test, Obj0, Obj),
   db_recorded(db_i_test, Obj).

test(db_recorded_int3, [setup(setup)]) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   obj_rebase((object_v -> db_object_v), Obj0, Obj1),
   db_put_object(db_i_test, Obj1, Obj),
   db_recorded(db_i_test, Obj).

test(db_recorded_int4, [setup(setup)]) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   obj_rebase((object_v -> db_object_v), Obj0, Obj1),
   obj_rebase((object_v -> tarjan_vertex_v), Obj1, Obj2),
   db_put_object(db_i_test, Obj2, Obj),
   db_recorded(db_i_test, Obj),
   db_clear(db_i_test).

test(key_conflict1, [setup(model_db(Slod1))]) :-

   obj_construct(man_v,
                 [name, surname], ['Sergei', 'Lodyagin'],
                 Man1_0),
   obj_rebase((object_v -> db_object_v), Man1_0, Man1),

   arg(1, Man1, Man_V_Re_Id),

   findall(C,
           key_conflict(people, Man_V_Re_Id, Man1, C),
           List1),
   assertion(List1 =@= [Slod1]),

   obj_construct(man_v, [name], ['Sergei'], Man2_0),
   obj_rebase((object_v -> db_object_v), Man2_0, Man2),

   findall(Name,
           (  key_conflict(people, Man_V_Re_Id, Man2, O),
              obj_field(O, surname, Name)
           ),
           List2_U),
   msort(List2_U, List2),
   assertion(List2 =@= ['Ivan', 'Lodyagin', 'Sikorsky',
                        'Sysoev']),

   obj_construct(man_v, [], [], Man3_0),
   obj_rebase((object_v -> db_object_v), Man3_0, Man3),

   findall(C,
           key_conflict(people, Man_V_Re_Id, Man3, C),
           List3),
   length(List3, N3),
   assertion(N3 =:= 8),

   obj_construct(citizen_v, [name, id], ['Sergei', 4],
                 Man4_0),
   obj_rebase((object_v -> db_object_v), Man4_0, Man4),

   arg(1, Man4, Citizen_V_Re_Id),

   findall(Name,
           (key_conflict(people, Citizen_V_Re_Id, Man4, O),
            obj_field(O, surname, Name)
           ),
           List4_U),
   sort(List4_U, List4),
   assertion(List4 =@= ['Lodyagin', 'Sikorsky', 'Sysoev']),

   obj_construct(citizen_v,
                 [name, surname, id],
                 ['Igor', 'Litvin', 4], Man5_0),
   obj_rebase((object_v -> db_object_v), Man5_0, Man5),

   findall(Name,
           (key_conflict(people, Citizen_V_Re_Id, Man5, O),
            obj_field(O, surname, Name)
           ),
           List5),
   assertion(List5 =@= ['Sysoev']),

   obj_construct(callup_v,
                 [name, surname, id],
                 ['Igor', 'Litvin', 4], Man6_0),
   obj_rebase((object_v -> db_object_v), Man6_0, Man6),
   arg(1, Man6, Callup_V_Re_Id),

   findall(Name,
           ( key_conflict(people, Callup_V_Re_Id, Man6, O),
             obj_field(O, surname, Name)
           ),
           List6),
   assertion(List6 =@= ['Sysoev']).

test(key_conflict2, [setup(model_db2)]) :-

   obj_construct(citizen_v,
                 [name, surname, id],
                 ['Igor', 'Litvin', 4], Man5_0),
   obj_rebase((object_v -> db_object_v), Man5_0, Man5),
   arg(1, Man5, Citizen_V_Re_Id),

   findall(Name,
          (key_conflict(people2, Citizen_V_Re_Id, Man5, O),
            obj_field(O, surname, Name)
           ),
           List5),
   assertion(List5 =@= ['Petrenko']).

model_db(Slod1) :-

   db_clear(people),
   db_construct(people, man_v,
                [name, surname], ['Sergei', 'Lodyagin'],
                Slod1),

   db_construct(people, man_v,
                [name, surname], ['Sergei', 'Sikorsky']),
   db_construct(people, man_v, [name], ['Ivan']),
   db_construct(people, man_v,
                [name, surname], ['Artemiy', 'Lodyagin']),
   db_construct(people, man_v,
                [name, surname], ['Artemiy', 'Lebedev']),
   db_construct(people, citizen_v,
                [name, surname, id],
                ['Sergei', 'Sysoev', 4]),
   db_construct(people, citizen_v,
                [name, surname, id],
                ['Sergei', 'Ivan', 5]),
   db_construct(people, citizen_v,
                [name, surname, id],
                ['Igor', 'Ivan', 6]).

model_db2 :-

   db_clear(people2),
   db_construct(people2, callup_v,
                [id, surname], [4, 'Petrenko']).

setup :-

	db_clear(db_i_test).

:- end_tests(db_i).

:- begin_tests(db_i).
:- use_module(u(v)).
:- use_module(u(vd)).
:- use_module(u(internal/objects_i)).
:- use_module(u(internal/db_i)).
:- use_module(u(internal/db_vocab)).

test(db_functor_des, [setup(model_db(_))]) :-

   findall(F, db_functor_des(people, F, _, _), List1_0),
   msort(List1_0, List1),
   assertion(List1 == [callup_v, citizen_v, db_object_v, man_v]),

   findall(F,
           (F = man_v, db_functor_des(people, F, _, _)),
           List2_0),
   msort(List2_0, List2),
   assertion(List2 == [man_v]),

   findall(F,
           (F = citizen_v, db_functor_des(people, F, _, _)),
           List3_0),
   msort(List3_0, List3),
   assertion(List3 == [citizen_v]),

   findall(F,
           (F = callup_v, db_functor_des(people, F, _, _)),
           List4),
   assertion(List4 == [callup_v]).

test(db_next_class_id, [setup(setup)]) :-

	db_i:db_next_class_id(db_i_test, Id1),
	assertion(Id1 =:= 2),
	db_i:db_next_class_id(db_i_test, Id2),
	assertion(Id2 =:= 3),
	db_i:db_next_class_id(db_i_test, Id3),
	assertion(Id3 =:= 4).

% test local class id -> db class id conversion
test(db_conv_local_db1, [setup(setup)]) :-

	obj_construct(man_v, [], [], Man1),
	obj_rebase((object_v -> db_object_v), Man1, Man),
	arg(1, Man, Man_Local_Id),

	db_i:db_add_class(db_i_test, Man_Local_Id, Man_DB_Id, _),

	db_conv_local_db(db_i_test, Man_Local_Id,
			 Man_DB_Id1,_),

	assertion(Man_DB_Id =:= Man_DB_Id1),

	% object_v
	class_id(Object_Local_Id, object_v), !,
	db_conv_local_db(db_i_test, Object_Local_Id,
			 Object_DB_Id, _),

	assertion(Object_DB_Id =:= 1), % always 1
	assertion(Man_DB_Id =\= Object_DB_Id).

test(db_key_policy, [setup(setup)]) :-

   db_key_policy(db_i_test, Old1, New1),
   assertion(Old1 == throw),
   assertion(New1 == throw),

   db_key_policy(db_i_test, Old2, overwrite),
   assertion(Old2 == throw),

   db_key_policy(db_i_test, _, overwrite),
   db_key_policy(db_i_test, overwrite, _),
   db_key_policy(db_i_test, overwrite, overwrite),

   db_key_policy(db_i_test, overwrite, throw),

   db_key_policy(db_i_test, Old3, New3),
   assertion(Old3 == throw),
   assertion(New3 == throw).

test(db_recorded_int1,
     [setup(setup),
      error(domain_error(db_object_v_descendant, Obj0))]
    ) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   db_put_object(db_i_test, Obj0, _),
   db_recorded_int(db_i_test, Obj0).

test(db_recorded_int2, [setup(setup)]) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   db_put_object(db_i_test, Obj0, Obj),
   db_recorded(db_i_test, Obj).

test(db_recorded_int3, [setup(setup)]) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   obj_rebase((object_v -> db_object_v), Obj0, Obj1),
   db_put_object(db_i_test, Obj1, Obj),
   db_recorded(db_i_test, Obj).

test(db_recorded_int4, [setup(setup)]) :-

   obj_construct(man_v, [sex, name], [man, 'Adam'], Obj0),
   obj_rebase((object_v -> db_object_v), Obj0, Obj1),
   obj_rebase((object_v -> tarjan_vertex_v), Obj1, Obj2),
   db_put_object(db_i_test, Obj2, Obj),
   db_recorded(db_i_test, Obj),
   db_clear(db_i_test).

test(key_conflict1, [setup(model_db(Slod1))]) :-

   obj_construct(man_v,
                 [name, surname], ['Sergei', 'Lodyagin'],
                 Man1_0),
   obj_rebase((object_v -> db_object_v), Man1_0, Man1),

   arg(1, Man1, Man_V_Re_Id),

   findall(C,
           key_conflict(people, Man_V_Re_Id, Man1, C),
           List1),
   assertion(List1 =@= [Slod1]),

   obj_construct(man_v, [name], ['Sergei'], Man2_0),
   obj_rebase((object_v -> db_object_v), Man2_0, Man2),

   findall(Name,
           (  key_conflict(people, Man_V_Re_Id, Man2, O),
              obj_field(O, surname, Name)
           ),
           List2_U),
   msort(List2_U, List2),
   assertion(List2 =@= ['Ivan', 'Lodyagin', 'Sikorsky',
                        'Sysoev']),

   obj_construct(man_v, [], [], Man3_0),
   obj_rebase((object_v -> db_object_v), Man3_0, Man3),

   findall(C,
           key_conflict(people, Man_V_Re_Id, Man3, C),
           List3),
   length(List3, N3),
   assertion(N3 =:= 8),

   obj_construct(citizen_v, [name, id], ['Sergei', 4],
                 Man4_0),
   obj_rebase((object_v -> db_object_v), Man4_0, Man4),

   arg(1, Man4, Citizen_V_Re_Id),

   findall(Name,
           (key_conflict(people, Citizen_V_Re_Id, Man4, O),
            obj_field(O, surname, Name)
           ),
           List4_U),
   sort(List4_U, List4),
   assertion(List4 =@= ['Lodyagin', 'Sikorsky', 'Sysoev']),

   obj_construct(citizen_v,
                 [name, surname, id],
                 ['Igor', 'Litvin', 4], Man5_0),
   obj_rebase((object_v -> db_object_v), Man5_0, Man5),

   findall(Name,
           (key_conflict(people, Citizen_V_Re_Id, Man5, O),
            obj_field(O, surname, Name)
           ),
           List5),
   assertion(List5 =@= ['Sysoev']),

   obj_construct(callup_v,
                 [name, surname, id],
                 ['Igor', 'Litvin', 4], Man6_0),
   obj_rebase((object_v -> db_object_v), Man6_0, Man6),
   arg(1, Man6, Callup_V_Re_Id),

   findall(Name,
           ( key_conflict(people, Callup_V_Re_Id, Man6, O),
             obj_field(O, surname, Name)
           ),
           List6),
   assertion(List6 =@= ['Sysoev']).

test(key_conflict2, [setup(model_db2)]) :-

   obj_construct(citizen_v,
                 [name, surname, id],
                 ['Igor', 'Litvin', 4], Man5_0),
   obj_rebase((object_v -> db_object_v), Man5_0, Man5),
   arg(1, Man5, Citizen_V_Re_Id),

   findall(Name,
          (key_conflict(people2, Citizen_V_Re_Id, Man5, O),
            obj_field(O, surname, Name)
           ),
           List5),
   assertion(List5 =@= ['Petrenko']).

model_db(Slod1) :-

   db_clear(people),
   db_construct(people, man_v,
                [name, surname], ['Sergei', 'Lodyagin'],
                Slod1),

   db_construct(people, man_v,
                [name, surname], ['Sergei', 'Sikorsky']),
   db_construct(people, man_v, [name], ['Ivan']),
   db_construct(people, man_v,
                [name, surname], ['Artemiy', 'Lodyagin']),
   db_construct(people, man_v,
                [name, surname], ['Artemiy', 'Lebedev']),
   db_construct(people, citizen_v,
                [name, surname, id],
                ['Sergei', 'Sysoev', 4]),
   db_construct(people, citizen_v,
                [name, surname, id],
                ['Sergei', 'Ivan', 5]),
   db_construct(people, citizen_v,
                [name, surname, id],
                ['Igor', 'Ivan', 6]).

model_db2 :-

   db_clear(people2),
   db_construct(people2, callup_v,
                [id, surname], [4, 'Petrenko']).

setup :-

	db_clear(db_i_test).

:- end_tests(db_i).


Fix Ymin at 8 iso 0

Fix Ymin at 8 iso 0

#!/usr/bin/env gnuplot

# graph of battery voltage

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups14.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 4 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 4 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max)
Ymin = min(min(Yd_min, Yh_min), Yw_min)
R10 = (Ymax - Ymin) * 0.1
Ymax = Ymax + R10
# Ymin = Ymin - R10
Ymin = 8

set multiplot layout 1, 3 title "Batterij spanning ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Spanning [V]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Spanning [V]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of battery voltage

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups14.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 4 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 4 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max)
Ymin = min(min(Yd_min, Yh_min), Yw_min)
R10 = (Ymax - Ymin) * 0.1
Ymax = Ymax + R10
# Ymin = Ymin - R10
Ymin = 0

set multiplot layout 1, 3 title "Batterij spanning ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Spanning [V]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Spanning [V]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot


Possibly fix issue where gnuplot is too fast

Former-commit-id: 8d3941ff42bc7e2b64dc5cf29fe2b76bd29e9e29

if (!exists("FILENAME")) FILENAME='logs/gnuplot.log'

# Uses line number (uses DATA_NUM last lines in the data file (FILENAME)) as x axis
# and all of the actual sensor values as the y axis.
# plot for [i=1:PORT_NUM] '< tail -n '.DATA_NUM.' '.FILENAME using (column(i)) title 'Sensor '.i

if (DIR != '') {
    system ("rm -rf images/gnuplot/".DIR)
    system ("mkdir images/gnuplot/".DIR)
}

time_tick = 0
set xrange [0:DATA_NUM + 1]
# Set the size ratio to be the same in all directions
set size square
# set style data linespoints
set style line 1 lc rgb 'black' pt 3

set title 'Angular Displacement'
set xlabel 'Time Tick'
set ylabel 'Angle (deg)'
set yrange [-80:80]

while (1) {
    print "test"
    # Automatically update the last data point and replot
    if (DIR != '') {
        set term png size 1500,1500
        set grid
        set output sprintf('images/gnuplot/%s/vision_data%05.0f.png', DIR, time_tick)
        time_tick = time_tick + 1;
    }
    print "test"
    plot '< tail -n'.DATA_NUM.' '.FILENAME using 0:3 title 'Euclidean Distance' with linespoints pt 7, \
         '' using 0:3:(sprintf("%.2f",$3)) with labels nopoint offset char 0,1 font '6' notitle, \
         '< tail -n'.DATA_NUM.' '.FILENAME using 0:4 title 'Theta' with linespoints pt 7, \
         '' using 0:4:(sprintf("%.2f",$4)) with labels nopoint offset char 0,1 font '6' notitle
    # plot '< tail -n'.DATA_NUM.' '.FILENAME using 0:2 title 'Phi' with linespoints pt 7, \
    #      '' using 0:2:(sprintf("%.2f",$2)) with labels nopoint offset char 0,1 font '6' notitle, \
         # '< tail -n'.DATA_NUM.' '.FILENAME using 0:3 title 'Beta' with linespoints pt 7, \
         # '' using 0:3:(sprintf("%.2f",$3)) with labels nopoint offset char 0,1 font '6' notitle, \

    set term wxt persist size 1500,1500
    set output
    replot
}

if (!exists("FILENAME")) FILENAME='logs/gnuplot.log'

# Uses line number (uses DATA_NUM last lines in the data file (FILENAME)) as x axis
# and all of the actual sensor values as the y axis.
# plot for [i=1:PORT_NUM] '< tail -n '.DATA_NUM.' '.FILENAME using (column(i)) title 'Sensor '.i

if (DIR != '') {
    system ("rm -rf images/gnuplot/".DIR)
    system ("mkdir images/gnuplot/".DIR)
}

time_tick = 0
while (1) {
    set xrange [0:DATA_NUM + 1]
    # Set the size ratio to be the same in all directions
    set size square
    # set style data linespoints
    set style line 1 lc rgb 'black' pt 3

    # Automatically update the last data point and replot
    if (DIR != '') {
        set term png size 1500,1500
        set grid
        set output sprintf('images/gnuplot/%s/vision_data%05.0f.png', DIR, time_tick)
        time_tick = time_tick + 1;
    }
    set title 'Angular Displacement'
    set xlabel 'Time Tick'
    set ylabel 'Angle (deg)'
    set yrange [-80:80]
    plot '< tail -n'.DATA_NUM.' '.FILENAME using 0:3 title 'Euclidean Distance' with linespoints pt 7, \
         '' using 0:3:(sprintf("%.2f",$3)) with labels nopoint offset char 0,1 font '6' notitle, \
         '< tail -n'.DATA_NUM.' '.FILENAME using 0:4 title 'Theta' with linespoints pt 7, \
         '' using 0:4:(sprintf("%.2f",$4)) with labels nopoint offset char 0,1 font '6' notitle
    # plot '< tail -n'.DATA_NUM.' '.FILENAME using 0:2 title 'Phi' with linespoints pt 7, \
    #      '' using 0:2:(sprintf("%.2f",$2)) with labels nopoint offset char 0,1 font '6' notitle, \
         # '< tail -n'.DATA_NUM.' '.FILENAME using 0:3 title 'Beta' with linespoints pt 7, \
         # '' using 0:3:(sprintf("%.2f",$3)) with labels nopoint offset char 0,1 font '6' notitle, \

    set term wxt persist size 1500,1500
    set output
    replot
}


fix scale for line voltage

fix scale for line voltage

#!/usr/bin/env gnuplot

# graph of line voltage

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups13.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
#stats ifnameh using 3 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
#stats ifnamed using 3 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
#stats ifnamew using 3 name "Yw" nooutput

Ymax = 260   # max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = 180   # min(min(Yd_min, Yh_min), Yw_min) -1

set multiplot layout 1, 3 title "Actuele spanning ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Spanning [V]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):3 title " Spanning [V]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):3 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):3 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of line voltage

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups13.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 3 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 3 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

set multiplot layout 1, 3 title "Actuele spanning ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Spanning [V]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):3 title " Spanning [V]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):3 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):3 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot


Increase x range.

Increase x range.

# Note you need gnuplot 4.4 for the pdfcairo terminal.

# set terminal pdfcairo font "Gill Sans,9" linewidth 4 rounded fontscale 1.0
set terminal pdfcairo font "Gill Sans,7" linewidth 1 rounded fontscale 1.0

# Line style for axes
set style line 80 lt rgb "#808080"

# Line style for grid
set style line 81 lt 0  # dashed
set style line 81 lt rgb "#808080"  # grey

set grid back linestyle 81
set border 3 back linestyle 80 # Remove border on top and right.  These
             # borders are useless and make it harder
             # to see plotted lines near the border.
    # Also, put it in grey; no need for so much emphasis on a border.
# set xtics nomirror
# set ytics nomirror

#set log y
#set mxtics 10    # Makes logscale look good.

# Line styles: try to pick pleasing colors, rather
# than strictly primary colors or hard-to-see colors

# like gnuplot's default yellow.  Make the lines thick
# so they're easy to see in small plots in papers.
set style line 1 lc rgb "#A00000" pt 7
set style line 2 lc rgb "#00A000" pt 7
set style line 3 lc rgb "#5060D0" pt 7
set style line 4 lc rgb "#F25900" pt 7
# Let gnuplot decide the color, if more than 4 lines
set style line 5 pt 7
set style line 6 pt 7
set style line 7 pt 7
set style line 8 pt 7

set output outputname
set xlabel "ops/sec"
set ylabel "latency (sec)"

set key left bottom

set datafile missing '0'

# log scale on the y axis
# set logscale y 2
# set format y ""
# set ytics 1e-6, 10, 1
# set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
#                "10^-4" 0.0001)
# set mytics 10

set xrange [0:2000]
set yrange [0:*]

# set xrange [0:60]
# set yrange [0.5:64]

# Titles with spaces are not allowed
# These titles should be separated by "_" and here we replace by " "
pretty(title) = system("echo ".title." | sed 's/_/ /g'")

# Input file contains comma-separated values fields
set datafile separator ","

plot for [i=0:words(inputnames) - 1] word(inputnames, i + 1) using 1:2:3 with linespoint ls i + 1 title pretty(word(titles, i + 1))
replot for [i=0:words(inputnames) - 1] word(inputnames, i + 1) using 1:2:3 with labels offset char 1,0 notitle

# Note you need gnuplot 4.4 for the pdfcairo terminal.

# set terminal pdfcairo font "Gill Sans,9" linewidth 4 rounded fontscale 1.0
set terminal pdfcairo font "Gill Sans,7" linewidth 1 rounded fontscale 1.0

# Line style for axes
set style line 80 lt rgb "#808080"

# Line style for grid
set style line 81 lt 0  # dashed
set style line 81 lt rgb "#808080"  # grey

set grid back linestyle 81
set border 3 back linestyle 80 # Remove border on top and right.  These
             # borders are useless and make it harder
             # to see plotted lines near the border.
    # Also, put it in grey; no need for so much emphasis on a border.
# set xtics nomirror
# set ytics nomirror

#set log y
#set mxtics 10    # Makes logscale look good.

# Line styles: try to pick pleasing colors, rather
# than strictly primary colors or hard-to-see colors

# like gnuplot's default yellow.  Make the lines thick
# so they're easy to see in small plots in papers.
set style line 1 lc rgb "#A00000" pt 7
set style line 2 lc rgb "#00A000" pt 7
set style line 3 lc rgb "#5060D0" pt 7
set style line 4 lc rgb "#F25900" pt 7
# Let gnuplot decide the color, if more than 4 lines
set style line 5 pt 7
set style line 6 pt 7
set style line 7 pt 7
set style line 8 pt 7

set output outputname
set xlabel "ops/sec"
set ylabel "latency (sec)"

set key left bottom

set datafile missing '0'

# log scale on the y axis
# set logscale y 2
# set format y ""
# set ytics 1e-6, 10, 1
# set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
#                "10^-4" 0.0001)
# set mytics 10

set yrange [0:*]

# set xrange [0:60]
# set yrange [0.5:64]

# Titles with spaces are not allowed
# These titles should be separated by "_" and here we replace by " "
pretty(title) = system("echo ".title." | sed 's/_/ /g'")

# Input file contains comma-separated values fields
set datafile separator ","

plot for [i=0:words(inputnames) - 1] word(inputnames, i + 1) using 1:2:3 with linespoint ls i + 1 title pretty(word(titles, i + 1))
replot for [i=0:words(inputnames) - 1] word(inputnames, i + 1) using 1:2:3 with labels offset char 1,0 notitle


20160521T0928

#!/usr/bin/env gnuplot

# graph of humidity (and temperature)

# datafile
ifnameh = "/tmp/domog/mysql/sql22h.csv"
ifnamed = "/tmp/domog/mysql/sql22d.csv"
ifnamew = "/tmp/domog/mysql/sql22w.csv"
set output ofname = "/tmp/domog/site/img/day22.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera" 9 size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
# Positions of split between graphs
LMARG = 0.056
LMPOS = 0.403
MRPOS = 0.75
RMARG = 0.96

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - 946684800
Xh_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
stats ifnameh using 3 name "Yh" nooutput

# stats for Y2-axis
stats ifnameh using 4 name "Y2h" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - 946684800
Xd_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# stats for Y2-axis
stats ifnamed using 4 name "Y2d" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - 946684800
Xw_max = X_max + utc_offset - 946684800

# stats for Y-axis
stats ifnamew using 3 name "Yw" nooutput

# stats for Y2-axis
stats ifnamew using 4 name "Y2w" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1
Y2max = max(max(Y2d_max, Y2h_max), Y2w_max) +1
Y2min = min(min(Y2d_min, Y2h_min), Y2w_min) -1

set multiplot layout 1, 3 title "Humidity \\& Temperature (DHT22) ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Humidity [%]"
set yrange [ Ymin : Ymax ]

# **************************************************************** Y2-axis *****
set y2label " "
set y2tics format " "
set y2range [ Y2min : Y2max ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "#cc0000bb" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Temperature [degC]" axes x1y2  with points pt 5 ps 0.2 fc rgb "#ccbb0000" \
  ,'' using ($2+utc_offset):3 title " Humidity [%]"      with points pt 5 ps 0.2 fc rgb "#cc0000bb" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# **************************************************************** Y2-axis *****
set y2label " "
set y2tics format " "
set y2range [ Y2min : Y2max ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "black" front
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 axes x1y2 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \
  ,'' using ($2+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#cc0000bb" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# **************************************************************** Y2-axis *****
set y2label "Temperature [degC]"
set y2tics format "%.0f"
set y2range [ Y2min : Y2max ]
set y2tics border

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "#ccbb0000" front
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 axes x1y2 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \
  ,'' using ($2+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#cc0000bb" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of humidity (and temperature)

# datafile
ifnameh = "/tmp/domog/mysql/sql22h.csv"
ifnamed = "/tmp/domog/mysql/sql22d.csv"
ifnamew = "/tmp/domog/mysql/sql22w.csv"
set output ofname = "/tmp/domog/site/img/day22.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera" 9 size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
# Positions of split between graphs
LMARG = 0.056
LMPOS = 0.403
MRPOS = 0.75
RMARG = 0.96

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - 946684800
Xh_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
stats ifnameh using 3 name "Yh" nooutput

# stats for Y2-axis
stats ifnameh using 4 name "Y2h" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - 946684800
Xd_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# stats for Y2-axis
stats ifnamed using 4 name "Y2d" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - 946684800
Xw_max = X_max + utc_offset - 946684800

# stats for Y-axis
stats ifnamew using 3 name "Yw" nooutput

# stats for Y2-axis
stats ifnamew using 4 name "Y2w" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1
Y2max = max(max(Y2d_max, Y2h_max), Y2w_max) +1
Y2min = min(min(Y2d_min, Y2h_min), Y2w_min) -1

set multiplot layout 1, 3 title "Humidity \\& Temperature (DHT22) ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Humidity [%]"
set yrange [ Ymin : Ymax ]

# **************************************************************** Y2-axis *****
set y2label " "
set y2tics format " "
set y2range [ Y2min : Y2max ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "#cc0000bb" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Temperature [degC]" axes x1y2  with points pt 5 ps 0.2 fc rgb "#ccbb0000" \
  ,'' using ($2+utc_offset):3 title " Humidity [%]"      with points pt 5 ps 0.2 fc rgb "#cc0000bb" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# **************************************************************** Y2-axis *****
set y2label " "
set y2tics format " "
set y2range [ Y2min : Y2max ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "black" front
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 axes x1y2 with points pt 5 ps 0.2 fc rgb "##ccbb0000" \
  ,'' using ($2+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#cc0000bb" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# **************************************************************** Y2-axis *****
set y2label "Temperature [degC]"
set y2tics format "%.0f"
set y2range [ Y2min : Y2max ]
set y2tics border

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "ccbb0000" front
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 axes x1y2 with points pt 5 ps 0.2 fc rgb "##ccbb0000" \
  ,'' using ($2+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#cc0000bb" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot


Y-scaling fix

Y-scaling fix

#!/usr/bin/env gnuplot

# graph of battery voltage

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups14.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 4 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 4 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) + 0.5
Ymin = min(min(Yd_min, Yh_min), Yw_min) - 0.5

set multiplot layout 1, 3 title "Batterij spanning ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Spanning [V]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Spanning [V]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of battery voltage

# datafiles
ifnameh = "/tmp/upsdiagd/mysql/upsh.csv"
ifnamed = "/tmp/upsdiagd/mysql/upsd.csv"
ifnamew = "/tmp/upsdiagd/mysql/upsw.csv"
set output "/tmp/upsdiagd/site/img/ups14.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 4 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 4 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max)
Ymin = min(min(Yd_min, Yh_min), Yw_min)
R10 = (Ymax - Ymin) * 0.1
Ymax = Ymax + R10
# Ymin = Ymin - R10
Ymin = 8

set multiplot layout 1, 3 title "Batterij spanning ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Spanning [V]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Spanning [V]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot