如何将gnuplot极极限制在180度范围内? [英] How do I limit a gnuplot polar to a 180 degree range?
问题描述
我正在尝试使用gnuplot在+/- 90度范围内绘制扬声器的离轴响应.我做的很好,几乎完全是由于创建麦克风极性gnuplot中的模式图
I am attempting to use gnuplot to plot the off axis response of a loudspeaker in the range +/- 90 degrees. I have this working nicely, almost entirely as a result of Creating a microphone polar pattern plot in gnuplot
我想扩展此范围,以便仅显示"180"的前向范围,但是我不知道该怎么做,并且会喜欢一些指针.
I would like to extend this so it presents the forward" 180 range only however I don't know how to do this & would appreciate some pointers.
到目前为止,这是我的代码
This is my code so far
gnuplot <<EOF
set terminal pngcairo size ${WIDTH}/2,${HEIGHT}/2 font ',10'
set polar
set angle degrees
set size ratio 1
set tmargin 3
set bmargin 3
set style line 11 lc rgb 'gray80' lt -1
set grid polar ls 11
unset border
unset xtics
unset ytics
set xrange [-30:30]
set yrange [-30:30]
set key
r=1
set rrange [0:r]
set rtics 0.166 format '' scale 0
set label '0°' center at first 0, first r*1.05
set label '180°' center at first 0, first -r*1.05
set label '-90°' right at first -r*1.05, 0
set label '+90°' left at first r*1.05, 0
set for [i=1:5] label at first r*0.02, first r*((i/6.0) + 0.03) sprintf("%d dB", -30+(i*5))
unset raxis
set key outside top right
set style line 11 lw 2
set output '${PREFIX}_polar.png'
set multiplot layout 1,2 title "Circular Polar Response"
set title "Normalised"
plot '${PREFIX}_norm_polar_1000.txt' t '1k' w lp ls 11 lt 1 pt -1 , \
'${PREFIX}_norm_polar_2000.txt' t '2k' w lp ls 11 lt 2 pt -1 , \
'${PREFIX}_norm_polar_4000.txt' t '4k' w lp ls 11 lt 3 pt -1 , \
'${PREFIX}_norm_polar_8000.txt' t '8k' w lp ls 11 lt 4 pt -1 , \
'${PREFIX}_norm_polar_16000.txt' t '16k' w lp ls 11 lt 5 pt -1
set title "Unnormalised"
plot '${PREFIX}_polar_1000.txt' t '1k' w lp ls 11 lt 1 pt -1 , \
'${PREFIX}_polar_2000.txt' t '2k' w lp ls 11 lt 2 pt -1 , \
'${PREFIX}_polar_4000.txt' t '4k' w lp ls 11 lt 3 pt -1 , \
'${PREFIX}_polar_8000.txt' t '8k' w lp ls 11 lt 4 pt -1 , \
'${PREFIX}_polar_16000.txt' t '16k' w lp ls 11 lt 5 pt -1
EOF
结果是
数据看起来像这样(这是示例图片中的1k行)
the data looks like this (this is the 1k line in the example picture)
180 0.657067
172.5 0.6832
165 0.717767
157.5 0.7461
150 0.7747
142.5 0.806167
135 0.835633
127.5 0.865167
120 0.890533
112.5 0.918133
105 0.929633
97.5 0.9566
90 0.9632
82.5 0.9566
75 0.929633
67.5 0.918133
60 0.890533
52.5 0.865167
45 0.835633
37.5 0.806167
30 0.7747
22.5 0.7461
15 0.717767
7.5 0.6832
0 0.657067
推荐答案
如果使用与rrange设置相反的xrange和yrange设置,则Gnuplot会感到困惑.这就是为什么忽略yrange设置的原因.
Gnuplot gets confused if you use xrange and yrange setting which contradict the rrange setting. Thats probably why the yrange settings are ignored.
然后,还必须使用set size ratio -1
才能在x和yrange中获得相同的缩放比例.当仅绘制上面两个象限时,使用set size square
会得到错误的长宽比.
Then, you must also use set size ratio -1
in order to get the same scaling in x and yrange. When plotting only the upper two quadrants, you would get a wrong aspect ratio with set size square
.
set terminal pngcairo font ',10'
set polar
set angle degrees
set size ratio 1
set lmargin 8
set style line 11 lc rgb 'gray80' lt -1
set grid polar ls 11
unset border
unset tics
set xrange [-1:1]
set yrange [0:1]
set size ratio -1
r = 1
set rtics 0.166 format '' scale 0
set label '0°' center at first 0, first r*1.05
set label '-90°' right at first -r*1.05, 0
set label '+90°' left at first r*1.05, 0
set for [i=1:5] label at first r*0.02, first r*((i/6.0) + 0.03) sprintf("%d dB", -30+(i*5))
unset raxis
set key outside top right
set output 'polar.png'
plot 'norm_polar_1000.txt' w lp ls 1 t '1k'
这篇关于如何将gnuplot极极限制在180度范围内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!