From 8f7fe4f016b37dea8daa691195a510de629d6e36 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Mon, 2 Feb 2026 09:54:12 +0100 Subject: [PATCH] added label for T(max) to chart. --- bin/plot_cpu_temp.sh | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/bin/plot_cpu_temp.sh b/bin/plot_cpu_temp.sh index 528e96c..4c11225 100755 --- a/bin/plot_cpu_temp.sh +++ b/bin/plot_cpu_temp.sh @@ -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'; "