Skip to content
Snippets Groups Projects
Commit fa1c1fdc authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

kissplotcsv: futher improve plotting script, remove eisgenerator_plot, as...

kissplotcsv: futher improve plotting script, remove eisgenerator_plot, as using kissplotcsv with stdin is a full and improved replacement
parent fa12d4a6
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
if ! command -v eisgenerator_export &> /dev/null
then
echo "eisgenerator_export is required in \$PATH"
exit
elif ! command -v gnuplot &> /dev/null
then
echo "gnuplot is required in \$PATH"
exit
fi
eisgenerator_export -q "$@" | gnuplot -p -e "\
set terminal qt enhanced font \",15\" title \"EIS Simulation\"; \
set style line 1 lw 3 lc \"blue\"; \
set ylabel 'Z_{im}'; \
set xlabel 'Z_{re}'; \
set tics font \"Helvetica,12\"; \
set xlabel font \"Helvetica,15\"; \
set ylabel font \"Helvetica,15\"; \
set datafile separator ','; \
plot '-' using 2:3 skip 3 notitle w l;
"
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
print_help () { print_help () {
echo "Usage: kisscsvplot -f [filename]" echo "Usage: kisscsvplot -f [filename]"
echo "Options:"
echo " -h: print this help"
echo " -x: Set x axis label"
echo " -y: Set y axis label"
echo " -r: plot a bode plot of re(Z)"
echo " -i: plot a bode plot of im(Z)"
echo " -l: allways use linear scale"
} }
if ! command -v gnuplot &> /dev/null; then if ! command -v gnuplot &> /dev/null; then
...@@ -14,7 +21,7 @@ xLabel='Z_{im}' ...@@ -14,7 +21,7 @@ xLabel='Z_{im}'
yLabel='Z_{re}' yLabel='Z_{re}'
logscale="" logscale=""
while getopts "?rihy:x:f:" opt; do while getopts "?rihy:x:f:l" opt; do
case "$opt" in case "$opt" in
h|\?) h|\?)
print_help print_help
...@@ -41,6 +48,9 @@ while getopts "?rihy:x:f:" opt; do ...@@ -41,6 +48,9 @@ while getopts "?rihy:x:f:" opt; do
x) x)
xLabel=$OPTARG xLabel=$OPTARG
;; ;;
l)
logscale=""
;;
esac esac
done done
...@@ -49,7 +59,19 @@ if [[ ! -f $file && $file != "-" ]]; then ...@@ -49,7 +59,19 @@ if [[ ! -f $file && $file != "-" ]]; then
exit 1 exit 1
fi fi
gnuplot -p -e "\ if [[ $file != "-" ]]; then
spectra="$(< $file)"
else
spectra="$(< /dev/stdin)"
fi
header=$(echo "$spectra" | awk -F, 'NR==1{print $1}')
if [[ $header != "EISF" ]]; then
echo "$file is not a valid EIS spectra file!"
exit 1
fi
echo "$spectra" | gnuplot -p -e "\
set terminal qt enhanced font \",15\" title \"EIS Plot\"; \ set terminal qt enhanced font \",15\" title \"EIS Plot\"; \
set style line 1 lw 3 lc \"blue\"; \ set style line 1 lw 3 lc \"blue\"; \
set ylabel '$yLabel'; \ set ylabel '$yLabel'; \
...@@ -59,5 +81,5 @@ set tics font \"Helvetica,12\"; \ ...@@ -59,5 +81,5 @@ set tics font \"Helvetica,12\"; \
set xlabel font \"Helvetica,15\"; \ set xlabel font \"Helvetica,15\"; \
set ylabel font \"Helvetica,15\"; \ set ylabel font \"Helvetica,15\"; \
set datafile separator ','; \ set datafile separator ','; \
plot '$file' using $mode skip 3 notitle w l; plot '-' using $mode skip 3 notitle w l;
" "
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment