XRD 光谱峰中值的标记

labeling of values in XRD spectral peaks

按照这个旧 post,我很想知道如何手动将标签放在山峰上。

有这样的东西:

第 1 版

我已经修改了这两个代码以使其适应我想要的,但是我有一个错误。

我的代码如下:

set terminal postscript enhanced color"Times-Roman" 20
set xlabel "2{/Symbol Q} (°)"
set ylabel "Intensity (a.u.)"
set xrange [10:90]
set key off
set decimalsign
set output "UHTC-XRD.eps"
set palette defined (1 "red", 2 "green", 3 "blue")
unset colorbox
array Materials[3] = ["ZrB_2", "SiC", "C"]
Gap = 150
Length = 500
plot  "XRD_UHTC_data.txt" using 2:1 with lines lc rgb "blue" title "lines", "peaksUHTC.txt" for [i=1:3] '' u (i==?:NaN):(+Gap+Length+Gap):3 w p pt 7 palette title Materials[i]

对于以下光谱数据(我只标出几行,+4000):

147 10.01
181 10.03
169 10.05
148 10.07
162 10.09
165 10.11
167 10.13

我得到这个数字:

第一个问题,如何删除 y 轴值? 关于peaks的标注,我做了如下文件作为例子

# PosY PeakX  Category
10697 41.77 1
6383 32.73 1
259 35.81 2
101 16.27 3

但是我在主文件中有这个错误:

"gnuXRD_UHTC.txt" 第 26 行:意外或无法识别的令牌

我看不出有什么问题。

一个建议(需要 gnuplot >=5.2):你需要有一个 datafile/datablock,其中包含峰值位置、峰值强度以及 material class(例如一个号码)。 由于我没有 XRD-data,我只是用脉冲绘制峰值(将此行替换为您的 XRD-data)。 然后使用 with vectors 作为峰值上方的短线,并使用 with points 作为符号。 一种方法是使用调色板来获取颜色作为 material class 的函数。 为了使图例的颜色正确,您需要在遍历 materials 时跳过某些曲线(表达式:...(i==?:NaN)...) 或许,还有其他(更简单?)方法可以达到同样的效果。

代码:

### labeling of peaks
reset session

$PeakData <<EOD
# PosX PeakY  Category
9.56   998.8  2
11.2  1215.9  3
26.9  1315.0  1
34.6  4927.5  1
36.6  1023.1  1
42.1  1262.3  1
46.0  1609.7  4
50.5  1404.1  1
55.4  1393.8  1
55.5  1686.6  2
56.9  1545.7  3
66.4   581.4  1
67.8   722.5  3
72.0   679.6  2
72.9   571.2  3
74.9   419.5  3
76.9   582.4  4
78.3   484.9  1
EOD

Gap = 150
Length = 500
set palette defined (1 "red", 2 "green", 3 "blue", 4 "orange")
unset colorbox
array Materials[4] = ["Material 1", "Material 2", "Material 3", "Material 4"]

plot $PeakData u 1:2 with impulses lw 2 lc rgb "violet" notitle, \
     $PeakData u 1:(+Gap):(0):(Length) with vectors nohead notitle, \
     for [i=1:4] '' u (i==?:NaN):(+Gap+Length+Gap):3 w p pt 7 palette title Materials[i]
### end of code

结果: