07fb77ef7c7a33314d9eca94c321f3d06a081f7f
[SaveMySugar/python3-savemysugar.git] / plot / symbols_distances.gnuplot
1 #!/usr/bin/gnuplot -persist
2 #
3 #    
4 #       G N U P L O T
5 #       Version 5.0 patchlevel 1    last modified 2015-06-07 
6 #    
7 #       Copyright (C) 1986-1993, 1998, 2004, 2007-2015
8 #       Thomas Williams, Colin Kelley and many others
9 #    
10 #       gnuplot home:     http://www.gnuplot.info
11 #       faq, bugs, etc:   type "help FAQ"
12 #       immediate help:   type "help"  (plot window: hit 'h')
13
14 set border 1
15 set nogrid
16 set key autotitles nobox reverse Left enhanced vert left at graph 0, screen 0.98
17
18 set noytics
19 unset colorbox
20
21 set xtics 5 out nomirror rotate by -45
22
23 set yrange[0:0.7]
24 set size ratio 0.3
25
26
27 set style arrow 1 heads fill size screen .02,15 lc 'gray'
28 set style arrow 2 nohead lc 'gray'
29
30 _w = 1280
31 _h = (_w * 0.39) * 2
32
33 # a helper function
34 max(a, b) = (a > b) ? a : b
35
36 symbols_distances_data = 'symbols_distances_defaults.log'
37
38 # Some other example
39 #symbols_distances_data = 'symbols_distances_optimistic.log'
40 #symbols_distances_data = 'symbols_distances_codex.log'
41 #symbols_distances_data = 'symbols_distances_savemysugar.log'
42
43 set terminal unknown
44
45 plot symbols_distances_data using 7:9
46 call_setup_time_min = GPVAL_DATA_X_MAX
47 call_setup_time_max = GPVAL_DATA_Y_MAX
48
49 plot symbols_distances_data using 0:20
50 num_symbols = GPVAL_DATA_X_MAX + 1
51 dot_distance_min = GPVAL_DATA_Y_MIN
52 EOM_distance_min = GPVAL_DATA_Y_MAX
53
54 plot symbols_distances_data using 0:16
55 symbol_distance_min = GPVAL_DATA_X_MIN
56 inter_call_distance = GPVAL_DATA_Y_MIN
57
58 symbol_distance = 2 * (call_setup_time_max - call_setup_time_min)
59 call_position = dot_distance_min - inter_call_distance
60
61 max_x = EOM_distance_min + symbol_distance
62
63 get_val(val) = val eq "inf" ? max_x : val
64 call_time(sym_dist) = abs(call_setup_time_max - first_call_time) + sym_dist + abs(second_call_time - call_setup_time_min)
65 symbol_bar_height(val) = (num_symbols - $0) / (2 * num_symbols)
66
67 set xrange [0:max_x + 3]
68 set yrange[0:0.6]
69
70 set terminal qt 0 enhanced font "Georgia,14" size _w,_h
71 #set terminal pngcairo notransparent  nocrop truecolor rounded enhanced font "Georgia,14" fontscale 1.0 size _w,_h
72 #set output 'pulse_distance_modulation.png'
73
74 set multiplot layout 2, 1 title "Relative symbol distances (receiver)" font "Georgia,14"
75
76 first_call_time = call_setup_time_max
77 second_call_time = call_setup_time_min
78
79 set title "Minimum call distance"
80 plot \
81   symbols_distances_data using (0):(0):(call_position):(call_position + call_time($16)):(0):(symbol_bar_height($0)):0 with boxxy \
82     fs solid noborder lc palette notitle, \
83   symbols_distances_data using ($20):(0.53):(get_val(strcol(22)) - $20):(0) with vectors arrowstyle 1 title 'receiver symbol interval', \
84   symbols_distances_data using ($20):(0):(0):(0.55) with vectors arrowstyle 2 notitle, \
85   symbols_distances_data using ($20 + symbol_distance / 2):(0.55):(strcol(11)) with labels font "Courier,12" notitle, \
86
87 first_call_time = call_setup_time_min
88 second_call_time = call_setup_time_max
89
90 set title "Maximum call distance"
91 replot
92
93 unset multiplot