From 0abf66fad504b9361d46a53503b74fad76cdf859 Mon Sep 17 00:00:00 2001 From: tTh Date: Tue, 6 Dec 2022 02:38:41 +0100 Subject: [PATCH] add a gnuplot/shell script --- GravityField/.gitignore | 3 +++ GravityField/README.md | 4 ++++ GravityField/plotation.sh | 42 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100755 GravityField/plotation.sh diff --git a/GravityField/.gitignore b/GravityField/.gitignore index 75d49c8..fbb7838 100644 --- a/GravityField/.gitignore +++ b/GravityField/.gitignore @@ -6,7 +6,10 @@ WS/*.pgm WS/*.png WS/*/*.pgm WS/*/*.png +WS/*/*.gif +WS/data/* +*.png *.gif *.log *.mp4 diff --git a/GravityField/README.md b/GravityField/README.md index b9e3e53..29223af 100644 --- a/GravityField/README.md +++ b/GravityField/README.md @@ -18,6 +18,10 @@ passer per une recompilation. Vous vous en doutez, c'est du POVray. +## Sortie graphique + +Actuellement, un script pour enrober gnuplot, what else ? + ## Conclusion Enjoy ! diff --git a/GravityField/plotation.sh b/GravityField/plotation.sh new file mode 100755 index 0000000..9993e23 --- /dev/null +++ b/GravityField/plotation.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +SRC=WS/data/00013.txt +DST=graph.png + +rm WS/graph/*.png + +# ---------------------------------------------------------- +plot_a_map () +{ +NUMERO=$1 + +SRC=$(printf "WS/data/%05d.txt" $NUMERO) +DST=$(printf "WS/graph/%05d.png" $NUMERO) +TXT=$(printf "Mass bodies #%05d" $NUMERO) + +echo " " $SRC $DST " " $TXT + +gnuplot << __EOC__ +set term png size 512,512 +set xrange [ 0.0 : 1024 ] +set yrange [ 0.0 : 1024 ] +set output "${DST}" +set ytics 256 +set xtics 256 +set grid front +set title "${TXT}" +plot "$SRC" using 1:2 title "location" +__EOC__ +} +# ---------------------------------------------------------- + +for foo in $(seq 0 8 1999) +do + plot_a_map $foo +done + +convert -delay 10 WS/graph/0????.png foo.gif + +# ----------------------------------------------------------