#!/bin/ksh set -eu bname=$(basename $0) : ${terminal:=} : ${title:=} : ${size:=} : ${origin:=} : ${rotate_x:=60} : ${rotate_z:=30} : ${scale_x:=1} : ${scale_z:=1} : ${xdata:=} : ${ydata:=} : ${zdata:=} : ${timefmt:=} : ${xlabel:=} : ${formatx:=} : ${minx:=} : ${maxx:=} : ${ylabel:=} : ${formaty:=} : ${miny:=} : ${maxy:=} : ${zlabel:=} : ${formatz:=} : ${minz:=} : ${maxz:=} : ${key:=} : ${plotting:=plot} : ${usings:=} : ${items:=} : ${styles:=} : ${lw:=} : ${boxwidth:=} : ${regexp:='\(.*\)'} : ${postload:=} function Usage { cat 1>&2 <&2 Usage ;; *) break ;; esac shift done : ${*:?} if [ -z "${usings}" ]; then if [ "${plotting}" = splot ]; then usings=1:2:3 else case ${styles} in xyerrorbars) usings=1:2:3:4:5:6 ;; yerrorbars) usings=1:2:3:4 ;; errorbars) usings=1:2:3 ;; *) usings=1:2 ;; esac fi fi cbuf=${styles} styles= field=1 for using in ${usings} do style=$(echo ${cbuf} | awk -v field=${field} '{print $field}') if [ -n "${style}" ];then styles="${styles:+${styles} }${style}" else if [ "${plotting}" = splot ];then styles="${styles:+${styles} }linespoints" else case $(echo "${using}" | awk -F: '{print NF}') in 6) styles="${styles:+${styles} }xyerrorbars" ;; 4) styles="${styles:+${styles} }yerrorbars" ;; 3) styles="${styles:+${styles} }errorbars" ;; *) styles="${styles:+${styles} }points" ;; esac fi fi ((field+=1)) done if [ -n "${terminal}" ]; then case ${terminal} in *) echo set terminal ${terminal} ;; esac fi for vname in boxwidth origin size xdata ydata zdata do if [ -n "`eval echo \\${${vname}}`" ]; then eval echo set ${vname} \${${vname}} fi done for vname in output timefmt title xlabel ylabel zlabel do if [ -n "`eval echo \\${${vname}}`" ]; then eval echo set ${vname} '\"'\${${vname}}'\"' fi done test -n "${formatx}" && echo set format x \"${formatx}\" test -n "${formaty}" && echo set format y \"${formaty}\" test -n "${formatz}" && echo set format z \"${formatz}\" if [ "${plotting}" = splot ]; then cat <