如何在xmgrace中使用批处理脚本
我正在尝试使用批处理脚本通过xmgrace绘制数据.但是,我在尝试查找有关如何执行此操作的文档时遇到了主要问题.我正在尝试制作一个面板图,其图形如下所示:
I am trying to use a batch script to plot data with xmgrace. However, I have encountered major problems in trying to find documentation on how to do this. I am trying to produce a panel plot, with graphs looking like this:
我在做这件事时遇到三件事:
I am having problems with three things in doing so:
1)我希望能够为面板图中的每个图指定x轴和y轴的限制(甚至更好地同时显示所有图),但我还没有找到如何做的方法这个.
1) I want to be able to specify the limits of the x- and y-axis for each graph in the panel plot (or even better for all graphs at the same time) and I haven't found how to do this.
2)数据存储在两个不同文件的六列中.两个文件的x值都在第1列中.我希望能够使用与gnuplot相似的语法导入数据,其中我将使用
2) The data is stored in six columns in two different files. The x-values are in column 1 for both files. I would like to be able to import the data with a similar syntax as in gnuplot where I'd use
使用1:(2.0 * $ 3)绘制'file.dat'
plot 'file.dat' using 1:(2.0*$3)
将第3列与第1列作图,并将第3列中的值乘以2.0.这里重要的是,我需要将一个文件中的某些列乘以2.0,以便以一种易于理解的方式将它们与另一个文件的内容进行比较.我还希望使用一种语法,该语法可以一次导入一个列,而不是使用
to plot column 3 against column 1, and multiply the values in column 3 by 2.0. The important thing here is that I need to multiply some of the columns in one of the files with 2.0 to compare them with the content of the other file in a comprehensible way. I would also prefer a syntax where I can import the columns one at a time, instead of using
读取NXY"file.dat"
READ NXY "file.dat"
它读取所有列,我必须杀死我不想要的列.
where it reads all columns and I have to KILL the ones I don't want.
3)如何更改图形的尺寸?使用
3) How do I change the dimensions of the graph? Changing the dimensions of the canvas using
PAGE SIZE的宽度,高度
PAGE SIZE width, height
不会更改图形的尺寸,或者会但不会填充画布.具有4 x 2图的面板图的默认大小(这是我想要的)没有显示足够的细节.
doesn't change the dimensions of the graph, or it does but not to fill the canvas. The default size for a panel plot with 4 by 2 graphs (which is what I want) does not show enough detail.
我发现此页面会有所帮助: http://ringo.ams.sunysb.edu/index.php/Xmgrace
I have found this page to be somewhat helpful: http://ringo.ams.sunysb.edu/index.php/Xmgrace
但它不包含我需要做的所有事例.
but it does not contain examples of everything I need to do.
到目前为止,我的批处理脚本如下:
So far, my batch script looks like:
#制作面板图
排列(1,1,.1,.2,.5,ON,OFF,OFF)
#选择第一个面板
焦点G0
#我希望这行允许我更改轴限制,但是它不起作用:
世界0,-1、20、1
#每个文件有6列
#s0至s4
读取NXY"file2.dat"
#s5至s9
读取NXY"file1.dat"
s0线色1
s1线色2
s2线色3
s3线色4
#s5和s6需要乘以2.0
s5线色1
s5 linestyle 4
s6线色2
s6 linestyle 4
s7线色3
s7 linestyle 4
s8线色4
s8线型4
s9线色5
杀死G0.s4
xaxis标签时间"
xaxis滴答处正常
yaxis标签密度"
PAGE SIZE 2500,2000
# make a panel plot
arrange (1,1,.1,.2,.5,ON,OFF,OFF)
# chose the first panel
FOCUS G0
# I was hoping this line would allow me to change the axis limits, but it isn't working:
world 0, -1, 20, 1
#each file has 6 columns
#s0 to s4
READ NXY "file2.dat"
#s5 to s9
READ NXY "file1.dat"
s0 line color 1
s1 line color 2
s2 line color 3
s3 line color 4
#s5 and s6 need to be multiplied by 2.0
s5 line color 1
s5 linestyle 4
s6 line color 2
s6 linestyle 4
s7 line color 3
s7 linestyle 4
s8 line color 4
s8 linestyle 4
s9 line color 5
KILL G0.s4
xaxis label "time"
xaxis tick place normal
yaxis label "density"
PAGE SIZE 2500, 2000
1)要同时为所有图形指定x轴和y轴的限制,请使用以下命令.
1) To specify the limits of the x- and y-axis for all graphs at the same time, use the following commands.
WORLD XMIN 0
WORLD XMAX 20
WORLD YMIN -2
WORLD YMAX 2
,还可以选择将x轴上的刻度线(主要和次要)指定为
and optionally specify the ticks (major and minor) along x-axis as
XAXIS TICK MAJOR 0.5
XAXIS TICK MINOR 0.25
2)一次导入一列的语法是
2) The syntax to import the columns one at a time is
READ BLOCK "file2.dat"
BLOCK xy "1:2"
BLOCK xy "1:3"
BLOCK xy "1:4"
BLOCK xy "1:5"
READ BLOCK "file2.dat"
BLOCK xy "1:2"
BLOCK xy "1:3"
BLOCK xy "1:4"
BLOCK xy "1:5"
BLOCK xy "1:6"
要对特定列执行代数运算,例如将"file.dat"
的columns 2
和3
与2
相乘,可以使用
To perform algebraic operations with specific columns, such as multiplying columns 2
and 3
of "file.dat"
with 2
, you can use
s4.y = 2*s4.y
s5.y = 2*s5.y
请注意,随着读入其他数据块,将创建带有增量后缀的较新的集,例如s0, s1, s2, ....
.由于未读取file2.dat
的column 6
,因此在此相对于原始脚本对集合进行了不同的编号.
Note that as additional blocks of data are read in, newer sets with incremental suffixes are created, such as s0, s1, s2, ....
. Since column 6
of file2.dat
is not read, the sets are numbered differently here relative to the original script.
3)更改图形的尺寸(例如G0
)
3) To change dimensions of a graph (say G0
)
FOCUS G0;
VIEW 0.15, 0.15, 0.15, 0.85