-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgnuplot-script.txt
More file actions
60 lines (59 loc) · 2.5 KB
/
gnuplot-script.txt
File metadata and controls
60 lines (59 loc) · 2.5 KB
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
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/gnuplot
#
# The calibration matrix (affine transformation with offset to origin):
#
# [[ 1.01353513e+00 -8.52264711e-03 -1.01621162e+03]
# [ -8.52264711e-03 1.00536644e+00 -1.29338712e+03]
# [ 0.00000000e+00 0.00000000e+00 1.00000000e+00]]
#
# The same matrix, as a Python array:
#
# sensor.calibration = [[1.013535132361361, -0.008522647106776193, -1016.2116244340472],
#[-0.008522647106776138, 1.005366442807312, -1293.387118453363],
#[0.0, 0.0, 1.0]]
#input_data = "magnet-data_20200307_0424.txt"
set output "magnet-data_20200307_0424.png"
circle_size = 5250 * 0.02
raw_data_color = "#28e828"
ellipse_color = "#38a838"
affine_offset_color = "#d0d0d0"
affine_centered_color = "#c020c0"
set term png size 1200, 1200 font "Helvetica,18"
set style line 100 lc rgb raw_data_color lw 1
set style line 300 lc rgb ellipse_color lw 3
set style line 400 lc rgb affine_offset_color lw 3
set style line 500 lc rgb affine_centered_color lw 3
set style fill transparent solid 0.50
set title "QMC5883L Magnetic Sensor X-Y Plane Calibration"
set size ratio 1
set xzeroaxis
set yzeroaxis
set xrange [-5250:5250]
set yrange [-5250:5250]
set label 40 center at graph 0.5,char 1.5 \\
"Ellipse center (x, y) = (1013, 1295), Semi-axis (a, b) = (2408, 2453), Rotation = -32.2\xc2\xb0"
set bmargin 5
set object 20 ellipse center 1013.53,1295.08 size 4816.44,4907.48 angle -32.20 \\
front fillstyle empty border lc rgb ellipse_color lw 3
set object 10 circle center 1013.53,1295.08 size 2453.74 \\
front fillstyle empty border lc rgb affine_offset_color lw 3
set object 30 circle center 0,0 size 2453.74 \\
front fillstyle empty border lc rgb affine_centered_color lw 3
plot input_data using 1:2:(circle_size) with circles linestyle 100 \\
title "Raw Data", \\
"<echo \'1013.53 1295.08 3051.41 11.89\\n1013.53 1295.08 2320.97 3371.47\'" \\
using 1:2:($3-$1):($4-$2) with vectors nohead linestyle 300 \\
title "Best Fit Ellipse", \\
"<echo \'1013.53 1295.08 3269.11 2220.68\\n1013.53 1295.08 3291.75 2206.42\'" \\
using 1:2:($3-$1):($4-$2) with vectors nohead linestyle 400 \\
title "Affine Transformation from Ellipse to Circle", \\
"<echo \'3269.11 2220.68\\n3291.75 2206.42\'" \\
using 1:2:(circle_size) with circles linestyle 400 \\
title "Transformation: Example Point", \\
"<echo \'0 0 2278.22 911.35\'" \\
using 1:2:($3-$1):($4-$2) with vectors nohead linestyle 500 \\
title "Transformation Circle: Offset to Origin", \\
"<echo \'2278.22 911.35\'" \\
using 1:2:(circle_size) with circles linestyle 500 \\
title "Example Point: Offset to Origin"
'