plot using gnuplot or python -


i have txt file trajectories. how can plot column 3 gnuplot , have vertical line separate trajectories.

#indexes:         0    1        -0.375e+04         0.382e+01            2        -0.375e+04         0.332e+01            3        -0.376e+04         0.353e+01         #indexes:        1    1        -0.735e+04         0.093e+01    2        -0.735e+04         0.096e+01    3        -0.735e+04         0.082e+01    4        -0.735e+04         0.094e+01 #indexes:         2    1        -0.835e+04         0.401e+01    2        -0.035e+04         0.438e+01    3        -0.365e+04         0.438e+01  

i have many indexes.

photo:

enter image description here

here's example shell script works example data. assumes data in file data, creates 2nd tmp file /tmp/data2, , image /tmp/data.png.

#!/bin/bash max=$(awk <data '  !/^#indexes/{ if($3+0>max)max = $3 }  end {print max}')  awk <data >/tmp/data2 -vmax="$max" '   /^#indexes/ {printf "%s %s\n",i,max; next}               { i++; }'  gnuplot <<\! set terminal png set output "/tmp/data.png" plot "data" using 3 lines linetype rgb "red",\  "/tmp/data2" using 1:2 impulse linetype rgb "blue" ! # eg: display /tmp/data.png 

the first awk finds max value of 3rd field. 2nd awk creates data line "i max" each "#indexes" line, i counts number of data lines, i.e. x axis values blue vertical lines.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -