aboutsummaryrefslogtreecommitdiff
path: root/plot_jerk.gnuplot
blob: f09e9706ef89fa9dbdb5df7e50332099e4eed384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- Gnuplot -*-

# Usage:
#   gnuplot -e "before='original.csv'; after='compensated.csv'; out='jerk.svg'" plot_jerk.gnuplot
#
# CSV columns expected from diagnostics.c:
#   1 t, 11 j_abs, 14 is_work, 15 is_traverse

if (!exists("before")) before = "original.csv"
if (!exists("after"))  after  = "compensated.csv"
if (!exists("out"))    out    = "res/jerk.tex"

set encoding utf8
set datafile separator comma
set term cairolatex pdf input \
    blacktext notransparent nocrop \
    size 16.5cm,10cm \
    noheader
set output out

set format y "\\text{%.0f}"
set format x "\\text{%.0f}"
set x2label "Время, $t$ (с)"
set y2label "Рывок, $j$ (м/с$^\\text{3}$)" offset 1,0
set grid
set key center bmargin horizontal maxrows 2
set key width -4
set key samplen 1.5   # Shortens the little colored line sample
set key spacing 1.2   # Adds slight vertical space between the two rows
set key Left      # Left-aligns the text descriptions
set key reverse   # Swaps the sample line and text position (Line comes AFTER text)

# Цвет различает набор данных, тип линии различает тип участка:
#   сплошная — рабочий участок;
#   штриховая — нерабочий участок G0.
set style line 1 lc rgb "#1f77b4" lw 1.7 dt 1
set style line 2 lc rgb "#1f77b4" lw 1.7 dt 3
set style line 3 lc rgb "#d62728" lw 1.7 dt 1
set style line 4 lc rgb "#d62728" lw 1.7 dt 3

set autoscale noextend
set xrange [0:8]

plot before every ::1 using 1:(column(14) > 0.5 ? column(11)/1000 : 1/0) with lines ls 1 title "Исходный, рабочие", \
     before every ::1 using 1:(column(15) > 0.5 ? column(11)/1000 : 1/0) with lines ls 2 title "Исходный, холостые", \
     after  every ::1 using 1:(column(14) > 0.5 ? column(11)/1000 : 1/0) with lines ls 3 title "Уточнённый, рабочие", \
     after  every ::1 using 1:(column(15) > 0.5 ? column(11)/1000 : 1/0) with lines ls 4 title "Уточнённый, холостые"

set output