【发布时间】:2025-12-29 05:35:15
【问题描述】:
我有一个我想要绘制的感兴趣化合物的红外光谱,并且我有一个包含所有数据点的 spectrum.dat 文件。它的形式是:
# X Y
300 100
301 100
302 99
303 70
...
3999 98
4000 100
我想使用典型的 IR 光谱 x 轴来绘制此图,但我在这样做时遇到了麻烦。 If you are unfamiliar, this is what a typical IR spectrum might look like(除了图表本身的标签)。请注意,x 轴是反转的,并且在超过 2000 个单位(厘米倒数)时,它的缩放比例突然加倍。有没有办法强迫 Gnuplot 以这种方式绘制我的数据?到目前为止,我已经设法想出了以下脚本:
# Make an SVG of size 800x500
set terminal svg size 800,500 fname 'CMU Sans Serif' fsize '10'
set output 'ir.svg'
# Color definitions
set border linewidth 1.5
set style line 1 lc rgb '#a0a0a0' lt 1 lw 2 pt 7 # gray
# Format graph
unset key
set xlabel 'Wavenumbers'
set ylabel 'Transmittance'
set xrange [4000:300]
# Plot data
plot 'spectrum.dat' with lines ls 1
这很好地反转了 x 轴,但我不知道如何以这种不寻常的方式更改缩放比例。
【问题讨论】:
-
如果使用
set link并且可以选择gnuplot 的开发版本,请参见gnuplot: how to set custom non linear scales。下一个即将推出的 gnuplot 5.0 版现在甚至有一个候选版本:)
标签: plot gnuplot spectrum infrared chemistry