gnuplot 一张图有两个轴(dB 和强度)

gnuplot one graph with two axes (dB and intensity)

我需要绘制一张表示声音随持续时间变化的图表。声音需要按强度(功率)和 dB 进行缩放。

这是我目前尝试过的方法:

gnuplot <<EOF

# first part duration this is easy
set terminal png size 1024,768 enhanced font "Helvetica,20"
set output 'output.png'
set yrange [0:60];
set ylabel "duration";
set ytics 5 nomirror textcolor lt 1;

# second part intensity and dB
set xrange [0:100];
set xlabel "intensity";
set xtics 5 nomirror textcolor lt 1;
set x2range [0:10];
set x2label "dB";
set x2tics 5 nomirror textcolor lt 1;
plot \
"data.dat" using 2:1 axes x1y1 title 'Graph' with points pt 7 ps 4,\
"data.dat" using 2:1 linetype 1 axes x2y1 title '';

问题在于,如果两个轴的起始和终止正确,则 dB (log(intensity/intensity_ref)) 值的分散与强度的分散不同,完全成比例。

如何指定一把斧头的公式?不仅对于声音图形,是否可以指定一个围绕一个轴的散布公式? (我也想如果我可以有两个 x 轴,比如 x 和 x^2 色散)。

非常感谢!

要在一个轴上以线性比例绘制强度,在另一轴上以 dB 为单位绘制强度,您必须在相应的列上应用适当的比例:

plot 'data.dat' using 2:1, 'data.dat' using (log10(column(2))):1 axes x2y1