# HG changeset patch # User wim # Date 1503393733 -7200 # Node ID f94099a0277a1454d5e458324447556be13de798 # Parent f93786d4f68e509f3dc9affa09da89540273c189 pylab plot vervangen door gnuplot commando cntl-0 aan scite toegevoegd om python script in terminal uit te voeren zodat ook raw_input werkt diff -r f93786d4f68e -r f94099a0277a SciTE.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SciTE.properties Tue Aug 22 11:22:13 2017 +0200 @@ -0,0 +1,2 @@ +command.name.0.*.py=Go in Terminal +command.0.*.py=xfce4-terminal -x sh -c "$(command.go.*.py)" diff -r f93786d4f68e -r f94099a0277a gpx_reduce.py --- a/gpx_reduce.py Mon Aug 21 14:07:37 2017 +0200 +++ b/gpx_reduce.py Tue Aug 22 11:22:13 2017 +0200 @@ -379,28 +379,30 @@ # plot result to screen if options.plot: - import pylab as pl + from subprocess import Popen, PIPE + latm, lonm, elesum = xyz_to_latlonele(sumx, sumy, sumz) for trkseg in tracksegs_old: - y_old = [] - x_old = [] + data_old = [] for trkpt in trkseg: xy = project_to_meters(trkpt[0], trkpt[1], latm, lonm) - x_old.append(xy[0]) - y_old.append(xy[1]) - pl.plot(x_old, y_old, 'r.-') + data_old.append (xy) for trkseg in tracksegs_new: - y_new = [] - x_new = [] + data = [] for trkpt in trkseg: xy = project_to_meters(trkpt[0], trkpt[1], latm, lonm) - x_new.append(xy[0]) - y_new.append(xy[1]) - pl.plot(x_new, y_new, 'b.-') - pl.grid() - pl.gca().set_aspect('equal') - pl.xlabel('x [m]') - pl.ylabel('y [m]') - pl.show() \ No newline at end of file + data.append (xy) + + #~ gnuPlotCmd = ['gnuplot', '-persist'] + gnuPlotCmd = ['gnuplot'] + plot = Popen (gnuPlotCmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) + plot.stdin.write (b"plot '-' with linespoints lc rgb 'red' pt 4, '-' with linespoints pt 6\n") + plot.stdin.write ("\n".join ('%f %f' % d for d in data).encode ()) + plot.stdin.write (b'\ne\n') + plot.stdin.write ("\n".join ('%f %f' % d for d in data_old).encode ()) + plot.stdin.write (b'\ne\n') + plot.stdin.flush () + #~ raw_input ('druk') + while 1: time.sleep (1)