summaryrefslogtreecommitdiff
path: root/gpsprobe
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-09-10 15:51:32 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-09-10 15:51:32 +0000
commitbc739da244389b6560724c7a397a28508bfe51ef (patch)
tree4047b0c29a1933439beb4e83036c0cffc57791c2 /gpsprobe
parent7cbe027fbec33c5337988e429876dd6cd26d2966 (diff)
downloadgpsd-bc739da244389b6560724c7a397a28508bfe51ef.tar.gz
Plot scatter rather than coordinates. Alas, this doesn't solve the
aspect-ratio problem.
Diffstat (limited to 'gpsprobe')
-rwxr-xr-xgpsprobe16
1 files changed, 9 insertions, 7 deletions
diff --git a/gpsprobe b/gpsprobe
index a3066f5a..f914f5ce 100755
--- a/gpsprobe
+++ b/gpsprobe
@@ -190,6 +190,7 @@ if __name__ == '__main__':
def d(a, b): return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2)
fixes.sort(lambda x, y: cmp(d(centroid, x), d(centroid, y)))
print "Probable error is %f meters." % gps.EarthDistance(centroid, fixes[len(fixes)/2])
+ recentered = map(lambda fix: (fix[0]-centroid[0], fix[1]-centroid[1]), fixes)
sys.stdout.write("Writing fix scattergram to %s..." % outfile)
fp = open(outfile,"w")
fp.write("# This is a gnuplot script generated by gpsprobe.\n")
@@ -197,22 +198,23 @@ if __name__ == '__main__':
fp.write('set format x "%2.6f"\n')
fp.write('set format y "%2.6f"\n')
fp.write('set key below\n')
- fp.write('set xlabel \'Longitude\'\n')
- fp.write('set ylabel \'Latitude\' 6 # Put it right over the Y axis\n')
+ fp.write('set size ratio -1\n')
+ fp.write('set xlabel \'Longitude scatter from %f\'\n' % centroid[1])
+ fp.write('set ylabel \'Latitude scatter from %f\' 6 # Put it right over the Y axis\n' % centroid[0])
fp.write('centroidx=%f\n' % centroid[0])
fp.write('centroidy=%f\n' % centroid[1])
fp.write('cep=%f\n' % d(centroid, fixes[len(fixes)/2]))
fp.write('set parametric\n')
fp.write('set trange [0:2*pi]\n')
- fp.write('cx(t, r) = sin(t)*r+centroidx\n')
- fp.write('cy(t, r) = cos(t)*r+centroidy\n')
+ fp.write('cx(t, r) = sin(t)*r\n')
+ fp.write('cy(t, r) = cos(t)*r\n')
fp.write('chlen = cep/10\n')
- fp.write("set arrow from centroidx-chlen,centroidy to centroidx+chlen,centroidy nohead\n")
- fp.write("set arrow from centroidx,centroidy-chlen to centroidx,centroidy+chlen nohead\n")
+ fp.write("set arrow from -chlen,0 to chlen,0 nohead\n")
+ fp.write("set arrow from 0,-chlen to 0,chlen nohead\n")
fp.write('plot "-" using 1:2 title "%d GPS fixes", cx(t, cep),cy(t, cep) title "CEP (50%%)"\n' % len(fixes))
fp.write("#\n")
fp.write("# Lat Lon\n")
- for (lat, lon) in fixes:
+ for (lat, lon) in recentered:
fp.write(" %f %f\n" % (lat, lon))
fp.write("end\n")
fp.write("pause -1\n")