【发布时间】:2015-04-21 08:14:52
【问题描述】:
我需要使用 bash 脚本生成图形 gnuplot,因为我要绘制多个文件。
while [ $j -lt 30 ];
do
if [ -f ./MyFile[$j] ]; then
load 'Plot_Histogramma.plt'
fi
j=$(( $j + 1 ))
done
在“Plot_Hisogramma.plt”里面我有
set output "MyFile[$j].eps"
plot "./MyFile[$j]" using 2:1 title "MyTitle" with boxes ls 7 lc rgb "blue"
所以我需要一种方法将我的索引变量从脚本传递到 gnuplot。我尝试使用echo、printf 和导出,但也许我做错了什么。
【问题讨论】:
-
在我看来,您想在“Plot_Hisogramma.plt”中看到
MyFile[0].eps等。这真的是文件名吗?在我看来有点不寻常,我有一点印象,你可能会谈论 bash 中的一个变量,它看起来像 bash 中的${MyFile[0]}。如果不是这种情况,算了,只是评论... -
这很正常。您可以告诉 gnuplot 写入 postscript、jpg、png 等。它只是设置输出文件的格式(如果不是显示)