added label for T(max) to chart.

This commit is contained in:
2026-02-02 09:54:12 +01:00
parent 114a194758
commit 8f7fe4f016

View File

@@ -12,6 +12,7 @@ usage() {
verbose=false
COLOR='red'
PADDING=5
VALID_ARGS=$(getopt -o vho:c:t:l: --long verbose,help,output,color:,title:,logfile: -- "$@")
if [[ $? -ne 0 ]]; then
@@ -58,6 +59,21 @@ while [ : ]; do
;;
esac
done
#determine max and min values
read YMIN YMAX < <(
awk '
NR==1 { min=$2; max=$2 }
$2 < min { min=$2 }
$2 > max { max=$2 }
END { printf "%.1f %.1f\n", min, max }
' "${LOGFILE}"
)
echo "YMIN=${YMIN} YMAX=${YMAX}"
echo "Parameter geparsed."
# Eingabeparameter
@@ -67,17 +83,26 @@ if [ -z "$LOGFILE" ] || [ -z "$OUTFILE" ] || [ -z "$TITLE" ]; then
fi
echo "generating plot from ${LOGFILE}"
gnuplot -e "
gnuplot \
-e "OUTFILE='${OUTFILE}'" \
-e "LOGFILE='${LOGFILE}'" \
-e "TITLE='${TITLE}'" \
-e "COLOR='${COLOR}'" \
-e "YMAX=${YMAX}" \
-e "PADDING=${PADDING}" \
-e "YMIN=${YMIN}" \
-e "
set terminal pngcairo size 1800,800;
set output '${OUTFILE}';
set multiplot layout 1,2 title '${TITLE}';
set output OUTFILE;
set title TITLE;
set xlabel 'Zeit (s)';
set ylabel 'Temperatur (°C)';
set grid;
set key top left;
set title '${TITLE}';
plot '$LOGFILE' using 1:2 with lines lc rgb '${COLOR}' lw 2 title 'CPU-Temperatur'
set label sprintf('Tmax: %.1f°C', YMAX-PADDING) at graph 0.98,0.02 right;
plot LOGFILE using 1:2 with lines lc rgb COLOR lw 2 title 'CPU-Temperatur';
"