用Gnuplot进行批处理作图
来源:互联网 发布:冲锋枪 突击步枪 知乎 编辑:程序博客网 时间:2024/05/22 16:53
用Gnuplot进行批处理作图
一个目录里有三十多个一维谱文件,名字分别为S45202.01、S45202.02、S45202.03……把每个文件都画出图形,怎么做?用bash script + gunplot进行批处理可以很快搞定。
第一种方法:建立两个文件,gnuplot脚本文件和bash脚本文件:
plot.plt文件
set term postscript eps enhanced color
set output "S45202.01.eps"
set title "Spectrum"
set xlabel "Wavelength [{/Symbol l}]"
set xtics 5
set ylabel "Intension"
set ytics 500
set grid
set nokey
plot "S45202.01" using 1:2 with lines
batch文件
#!/bin/bash
sed "s/S45202.01/S45202.02/g" "plot.plt" | gnuplot
sed "s/S45202.01/S45202.04/g" "plot.plt" | gnuplot
... ...
这里使用了sed命令。更简便的方法是写成
#!/bin/bash for i in S45202.*
do sed "s/S45202.01/$i/g" "plot.plt" | gnuplot
done
之后./batch 就可以生成每幅图的eps图像了
更方便的办法是把gnuplot脚本和bash脚本写成一个文件
#!/bin/bash
for i in S45202.*
do gnuplot << EOF
set term postscript eps enhanced color
set output "$i.eps"
set title "Spectrum"
set xlabel "Wavelength [{/Symbol l}]"
set xtics 5
set ylabel "Intension"
set ytics 500
set grid
set nokey
plot "$i" using 1:2 with lines
EOF
done
本文参考了Gnuplot - not so Frequently Asked Questions
- 用Gnuplot进行批处理作图
- Gnuplot 作图
- GnuPlot作图(矢量图)
- 用JDBC进行批处理
- 怎么用gnuplot画动图
- gnuplot
- gnuplot
- gnuplot
- gnuplot
- gnuplot
- 应用Gnuplot进行数据的可视化 Ubuntu
- 计算进程的cpu使用率 gnuplot 作图 cpu使用率曲线示意图
- 用批处理对MySQL进行数据操作
- 教你用批处理进行字符串处理
- 用批处理进行进制转换
- 用Matlab对excel数据进行批处理
- 用批处理对MySQL进行数据操作
- android 用Achartengine 作图
- [转载]Gnuplot使用技巧
- Combating Spyware in the Enterprise
- Openvpn: Building And Integrating Virtual Private Networks
- Microsoft Windows Vista Unveiled
- How to Cheat at Securing a Wireless Network
- 用Gnuplot进行批处理作图
- Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
- Smarty Php Template Programming And Applications
- Web Site Measurement Hacks
- The Best Damn Windows Server 2003 Book Period
- Cleaning Windows XP For Dummies
- The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)
- ajax级连菜单全代码
- Python in a Nutshell