2020-09-29 19:41:53 +11:00
|
|
|
|
%
|
|
|
|
|
% nouveau 27 septembre 2020
|
|
|
|
|
%
|
|
|
|
|
\chapter{Gnuplot}
|
2020-11-13 11:35:31 +11:00
|
|
|
|
\index{Gnuplot}\label{chap:gnuplot}
|
2020-09-29 19:41:53 +11:00
|
|
|
|
|
2020-11-26 00:24:19 +11:00
|
|
|
|
Gnuplot - an interactive plotting program
|
|
|
|
|
|
2021-06-27 13:32:47 +11:00
|
|
|
|
There is an on-line demo collection at http://gnuplot.info/demo
|
|
|
|
|
|
2021-09-17 03:53:40 +11:00
|
|
|
|
\begin{verbatim}
|
|
|
|
|
gnuplot> splot "cam.indoor" using 2:4:3, "cam.indoor" using 5:7:6
|
|
|
|
|
\end{verbatim}
|
2021-06-27 13:32:47 +11:00
|
|
|
|
|
|
|
|
|
% -------------------------------------------------------------------
|
|
|
|
|
|
2020-09-29 19:41:53 +11:00
|
|
|
|
\section{Exemple : le phytotron}
|
|
|
|
|
\index{phytotron}
|
|
|
|
|
|
2021-09-17 03:53:40 +11:00
|
|
|
|
Un exemple réel, issu d'un projet d'élevage d'algues
|
2022-10-31 08:51:57 +11:00
|
|
|
|
bio-luminescentes dans un frigo bricolé par une jeune stagiaire
|
|
|
|
|
fort sympathique.
|
2021-09-17 03:53:40 +11:00
|
|
|
|
|
2022-10-31 08:51:57 +11:00
|
|
|
|
Le fichier des données contient cinq champs séparés par des espaces
|
|
|
|
|
ou des tabulations.
|
|
|
|
|
Le premier champ est
|
2021-09-17 03:53:40 +11:00
|
|
|
|
un \textsl{timestamp} exprimé en secondes depuis l'\textsl{epoch},
|
|
|
|
|
et les quatre suivants sont des températures en degrés Celsius.
|
2020-09-29 19:41:53 +11:00
|
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
|
#!/bin/bash
|
2021-06-27 13:32:47 +11:00
|
|
|
|
# THIS IS A KLUDGE
|
2020-09-29 19:41:53 +11:00
|
|
|
|
|
|
|
|
|
nbsamp=3000 # nombre d'echantillon
|
|
|
|
|
|
|
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
|
nbsamp=$1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
DATAFILE="serial/foo.dat"
|
|
|
|
|
IMAGE="graphe.png"
|
|
|
|
|
TMPFILE="/dev/shm/tmpdata"
|
|
|
|
|
tail -${nbsamp} < ${DATAFILE} > ${TMPFILE}
|
|
|
|
|
|
|
|
|
|
gnuplot << __EOC__
|
|
|
|
|
set term png size 1600,800
|
|
|
|
|
set output "${IMAGE}"
|
|
|
|
|
set ytics 2
|
|
|
|
|
set xtics
|
|
|
|
|
set grid front
|
|
|
|
|
set title "* Temperatures du Phytotron *"
|
|
|
|
|
set xdata time
|
|
|
|
|
set timefmt "%s"
|
|
|
|
|
set format x "%b %d\n%H:%M"
|
|
|
|
|
set yrange [ 10.0 : 40.0 ]
|
|
|
|
|
plot "${TMPFILE}" using 1:3 title " inside" with lines, \
|
|
|
|
|
"${TMPFILE}" using 1:4 title "ambient" with lines
|
|
|
|
|
__EOC__
|
|
|
|
|
\end{verbatim}
|
|
|
|
|
|
2021-09-17 03:53:40 +11:00
|
|
|
|
\textsf{Bon, un de ces jours, il faudrait que je ressorte des archives
|
|
|
|
|
l'enregistrement d'un été dans le dd2, pour que vous puissiez voir
|
2022-10-31 08:51:57 +11:00
|
|
|
|
le résultat de ce script en « pour de vrai ».}
|
|
|
|
|
|
|
|
|
|
% -------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
\section{Paramétrer la plume}
|
2021-09-17 03:53:40 +11:00
|
|
|
|
|
2023-10-09 06:56:41 +11:00
|
|
|
|
Largeur, couleur, odeur, toussa.
|
|
|
|
|
|
2022-02-16 10:53:49 +11:00
|
|
|
|
% -------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
\section{La 3D avec \texttt{splot}} \index{splot}
|
|
|
|
|
|
|
|
|
|
gnuplot> help set view
|
|
|
|
|
|
|
|
|
|
The `set view` command sets the viewing angle for `splot`s. It controls how
|
|
|
|
|
the 3D coordinates of the plot are mapped into the 2D screen space. It
|
|
|
|
|
provides controls for both rotation and scaling of the plotted data, but
|
|
|
|
|
supports orthographic projections only. It supports both 3D projection or
|
|
|
|
|
orthogonal 2D projection into a 2D plot-like map.
|
|
|
|
|
|
2023-10-09 06:56:41 +11:00
|
|
|
|
% -------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\section{Des trucs...}
|
2022-02-16 10:53:49 +11:00
|
|
|
|
|
2023-10-09 06:56:41 +11:00
|
|
|
|
Comment générer un signal carré~:
|
|
|
|
|
|
|
|
|
|
% https://lcamtuf.substack.com/p/square-waves-or-non-elephant-biology
|
|
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
|
set samples 2000
|
|
|
|
|
odd_h(x, n) = sin(x * (2*n - 1)) / (2*n - 1)
|
|
|
|
|
plot sum [n=1:20] 4/pi * odd_h(x, n)
|
|
|
|
|
\end{verbatim}
|
2022-02-16 10:53:49 +11:00
|
|
|
|
|
2021-06-27 13:32:47 +11:00
|
|
|
|
% -------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
\section{Questions}
|
|
|
|
|
|
|
|
|
|
Supposons que nous ayons sous le coude un fichier contenant
|
|
|
|
|
\emph{six cent mille} lignes de données, qui ne représentent que
|
|
|
|
|
trente secondes d'enregistrement d'une valeur de Virgo\index{Virgo},
|
|
|
|
|
comment faire pour plotter les échantillons $N$ à $N+42$ ?
|
|
|
|
|
|
2022-02-16 10:53:49 +11:00
|
|
|
|
for example \texttt{plot ’a.dat’ every 2}.
|
|
|
|
|
|
2021-06-27 13:32:47 +11:00
|
|
|
|
|
|
|
|
|
% -------------------------------------------------------------------
|
2020-09-29 19:41:53 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|