以下代码用于生成自由能图。出现了一个问题,形成的红色实线和蓝色实线不是形成一条线,而是分成两条线。
我真的不知道如何解决这个问题,因为这个脚本以前工作得很好。不幸的是,我无法在这里展示情节本身,所以请随意运行它,看看你会得到什么。也许是操作系统问题?
###subblocks to free energy diagrams###
set terminal emf font "Sans Bold,25" enhanced
set terminal emf size 620,530
makebold(text) = sprintf("{/:Bold %s}", text)
set border 15 front lt black linewidth 3.000 dashtype solid
set xlabel "Reaction Coordinate"
set xrange [-0.2:5.2]
set xtics nomirror scale 0
set ylabel "Free Energy (eV)"
set ylabel offset character 4.5,-3.0,0 font "Sans Bold,25" enhanced
set xlabel offset character 0,0.6,0 font "Sans Bold,25" enhanced
set yrange[-5:0.4]
set ytics in nomirror font "Sans Bold,25" enhanced
set key noautotitle samplen 2
set key enhanced
set errorbars 0
dx = 0.2
myFileOut(s) = sprintf("%s.emf",s)
myTitle(s) = sprintf("%s",s)
inputFiles = '/Users/total.dat'
outputDirs = "/Users//Free-Energy-2/"
do for [i=0:2] {
stats 'inputFiles' index i every ::::0 u (s=strcol(4),0) nooutput
set output outputDirs.myFileOut(s)
set title myTitle(s) offset 0,-0.93, 0
plot 'total.dat' index i u 0:2:(dx):xtic(makebold(strcol(1))) w xerr lc "blue" lw 3 ps 0 ti columnheader(2), \
'' index i u 0:3:(dx) w xerr lc "red" lw 3 ps 0 ti columnheader(3), \
x1=y1=NaN '' index i u (x0=x1,x1=$0,x0-1+dx):(y0=y1,y1=$2,y0):(1-2*dx):(y1-y0) w vec dt 4 lc "blue" nohead, \
x1=y1=NaN '' index i u (x0=x1,x1=$0,x0-1+dx):(y0=y1,y1=$3,y0):(1-2*dx):(y1-y0) w vec dt 4 lc "red" nohead
}
set output # close the last file
### end of script
使用的数据:
"Reaction Coordinate" "0 V" "0.40 V" "FeZn (7, 9)"
O_{2} 0.00 -2.29
O@^*_{2} -0.03 -2.31
OOH^* -1.05 -3.51
O^* -1.54 -4.18
OH^* -4.30 -4.92
H_{2}O -4.92 -4.92
"Reaction Coordinate" "0 V" "0.30 V" "FeZn (1, 9)"
O_{2} 0.00 -2.29
O@^*_{2} -0.03 -2.21
OOH^* -1.05 -3.51
O^* -1.54 -4.18
OH^* -4.30 -4.92
H_{2}O -4.92 -4.92
我无法在评论中附上数字,所以尽管我实际上还没有回答任何问题,但这与答案相同。
请告诉我们您正在使用的操作系统以及 gnuplot 的版本。
我可以看到一个问题:inputFiles 是一个包含文件名的字符串。但是您的 stats 命令将其放在引号中,以便程序尝试打开名为“inputFiles”的文件,而不是尝试打开名为“total.dat”的文件。如果我更正该问题并将字体大小更改为 15 而不是 25,我会得到看起来合理的输出。
我认为不可能附加 emf 文件,因此我附加了 png 终端的输出。这是在 Linux 上使用 gnuplot 5.4.10。除了线条粗细之外,我得到的电动势输出看起来相同。这与您得到的相符吗?