
下面是用于生成繪圖的腳本。我應該改變什么來修復 xtic 文本的間距?我有 macOS Catalina.@theozh
#/Users/CourtneyBrea/Desktop/ORR-Figures/free-energy-diagram
myFileIn(i) = sprintf("step-%d.dat",i)
myFileOut(i) = sprintf("step-%d.svg",i)
set term svg font "{/:Bold}Sans,22"
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 yrange[-5:0.1]
set ytics out nomirror
set key noautotitle samplen 2
set errorbars 0
dx = 0.2
do for [i=1:30] {
set output myFileOut(i)
plot myFileIn(i) u 0:2:(dx):xtic(1) w xerr lc "blue" lw 3 ps 0 ti columnheader(2), \
'' u 0:3:(dx) w xerr lc "red" lw 3 ps 0 ti columnheader(3), \
x1=y1=NaN '' 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 '' 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.43 V"
O_{2} 0 -3.00
O@^*_{2} -0.10 -3.67
OOH^* -1.00 -3.90
O^* -2.00 -4.00
OH^* -4.00 -4.92
H_{2}O -4.92 -4.92
uj5u.com熱心網友回復:
我懷疑問題在于您已將粗體文本的增強文本符號放置在字體名稱中,而不是將其放置在正在列印的文本中。這可能會混淆您用來查看生成的 svg 檔案的程式。
正確的方法是將終端字體設定為名稱和大小,然后單獨為文本字串添加任何附加標記。下面修改了命令,并在 Firefox 中查看了 svg 檔案的螢屏截圖。
請注意,我僅將粗體屬性應用于 tic 標簽,因為這是棘手的部分。您可以根據需要應用到其他標簽或文本。
set term svg font "Sans,22"
set output "gap.svg"
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 yrange[-5:0.1]
set ytics out nomirror
set key noautotitle samplen 2
set errorbars 0
dx = 0.2
plot "gap.dat" u 0:2:(dx):xtic(makebold(strcol(1))) w xerr lc "blue" lw 3 ps 0 ti columnheader(2), \
'' u 0:3:(dx) w xerr lc "red" lw 3 ps 0 ti columnheader(3), \
x1=y1=NaN '' 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 '' 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

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/511311.html
上一篇:如何在Automator(macOS)中使用本地檔案的相對路徑
下一篇:影像檔案未在R中以指定尺寸存盤
