Real Time Histogram Plot

From apertus wiki
Jump to: navigation, search

1 Files

Create two files with the following names and content:

1.1 ReadHistogrammData.sh

#!/bin/bash

while true;
do
	sshpass -p '*AXIOM-ALPHA-ROOT-PASSWORD*' ssh root@*AXIOM-ALPHA-IP* "./cmv_hist2 -s" > snap.hist
	gnuplot histogram.plot > histogram.svg
	sleep 0.25s
done

1.2 histogram.plot

set notitle
set term svg size 1024, 512
set multiplot
set obj 1 rectangle behind from screen 0,0 to screen 1,1
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "white"
set xrange[0:4096]
set yrange[0:9000]
plot 	'snap.hist' using 0:2	with lines lc rgb "#FF0000"   title "red", \
	'snap.hist' using 0:1   with lines lc rgb "#00FF00"   title "green", \
	'snap.hist' using 0:4   with lines lc rgb "#008000"   title "green", \
	'snap.hist' using 0:3   with lines lc rgb "#0000FF"   title "blue"
unset multiplot

2 Usage

Execute the background process that reads the histogram data in a loop:

./ReadHistogrammData.sh

Open the histogram.svg in Image Viewer, it will automatically refresh when the SVG is updated.