I have two arrays "bitrates" and "psnr". I want to write a bash script to plot it.
bitrates=(1 2 3 4 5)
psnrArray=()
psnr array is filled dynamically.
{ echo "${bitrates[*]}"; echo "${psnrArray[*]}"; } >Data
I have two arrays "bitrates" and "psnr". I want to write a bash script to plot it.
bitrates=(1 2 3 4 5)
psnrArray=()
psnr array is filled dynamically.
{ echo "${bitrates[*]}"; echo "${psnrArray[*]}"; } >Data
Creating your data file can be done like this:
x=(1 2 3 4)
y=(5 6 7 8)
for ((i=0; i<${#x[@]}; i++))
do
echo "${x[$i]}" "${y[$i]}"
done > data
Plotting using Gnuplot:
gnuplot -p -e "plot 'data' with lp"
paste <(printf "%d\n" "${x[@]}") <(printf "%d\n" "${y[@]}") > data.