如何使用 gnuplot 突出显示绘图区域

How to highlight regions of plot with gnuplot

如果有人可以帮助解决这个问题,我将不胜感激。 我正在使用 gnuplot 5.0.0 绘制雷达(或蜘蛛网)图:

所有轴的刻度和范围相同。 1 及以上的数字具有特殊含义,我想强调这一点。

我正在考虑可以提高知名度的三件事:

  1. 只需将 1 处的刻度线(标记为 "Limit")设为粗体即可。我怎样才能突出显示特定的刻度和标签?

  2. 我还可以突出显示第 1 级的圆形虚线

  3. 在情节本身上,我希望半径 > 1 的背景颜色不同。

我怎样才能实现上述三个选项中的任何一个?当然,所有这三个都是理想的,但与该值的其余部分的最小差异将有所帮助。

这就是在 link 中生成情节的原因:

set term x11
set title "My title "
set polar
set angles degrees
npoints = 6

a1 = 360/npoints*1
a2 = 360/npoints*2
a3 = 360/npoints*3
a4 = 360/npoints*4
a5 = 360/npoints*5
a6 = 360/npoints*6

set grid polar 360
set size square
set style data lines

unset border

set grid ls 0
set linetype 1 lc rgb 'red' lw 2 pt 7 ps 2

M=2.2
set arrow from 0,0 to first M*cos(a1), M*sin(a1)
set arrow from 0,0 to first M*cos(a2), M*sin(a2)
set arrow from 0,0 to first M*cos(a3), M*sin(a3)
set arrow from 0,0 to first M*cos(a4), M*sin(a4)
set arrow from 0,0 to first M*cos(a5), M*sin(a5)
set arrow from 0,0 to first M*cos(a6), M*sin(a6)

a1_min = 0
a1_max = 1
a2_min = 0
a2_max = 1
a3_min = 0
a3_max = 1
a4_min = 0
a4_max = 1
a5_min = 0
a5_max = 1
a6_min = 0
a6_max = 1

set label "M1" at M*cos(a1),M*sin(a1) center offset char 1,1
set label "M2" at M*cos(a2),M*sin(a2) center offset char 1,1
set label "M3" at M*cos(a3),M*sin(a3) center offset char 1,1
set label "M4" at M*cos(a4),M*sin(a4) center offset char 1,1
set label "M5" at M*cos(a5),M*sin(a5) center offset char 1,1
set label "M6" at M*cos(a6),M*sin(a6) center offset char 1,1


set xrange [0:1]
set yrange [0:1]

set xtics axis 0,0.5,M
unset ytics

set rrange [0:M]

set rtics (""0,""0.25,""0.5,""0.75,"Limit"1,""1.25,""1.50,""1.75,""2)
set rtics scale 0 format ''

set style fill transparent solid 0.5
set style function filledcurves y1=0.5
set grid noxtics nomxtics noytics nomytics front


plot  '-' u (==1?a1:(==2?a2:(==3?a3:(==4?a4:(==5?a5:(==6?a6:)))))):(==1?((-a1_min)/(a1_max-a1_min)):(==2?((-a2_min)/(a2_max-a2_min)):(==3?((-a3_min)/(a3_max-a3_min)):(==4?((-a4_min)/(a4_max-a4_min)):(==5?((-a5_min)/(a5_max-a5_min)):(==6?((-a6_min)/(a6_max-a6_min)):)))))) w filledcurve lt 1 title "AAA",\
 '-' u (==1?a1:(==2?a2:(==3?a3:(==4?a4:(==5?a5:(==6?a6:)))))):(==1?((-a1_min)/(a1_max-a1_min)):(==2?((-a2_min)/(a2_max-a2_min)):(==3?((-a3_min)/(a3_max-a3_min)):(==4?((-a4_min)/(a4_max-a4_min)):(==5?((-a5_min)/(a5_max-a5_min)):(==6?((-a6_min)/(a6_max-a6_min)):)))))) w filledcurve lt 2 title "BBB"

1 2.1
2 1
3 0.1
4 0.5
5 0.5
6 0.1
1 2.1
EOF
1 2.2
2 0.9
3 0.9
4 0.2
5 0.3
6 0.1
1 2.2
EOF
set output

我冒昧地稍微简化了您的脚本,您现在可以轻松地调整网络中的武器数量。还为 1 >r > M.

添加了彩色背景

顺便说一句,不需要在最后再次输入第一个数据点来关闭轮廓。 更新:也就是说,不应该有。然而,最后一点和第一点之间的线丢失了,即使将 "closed" 选项赋予 "with filledcurve"。请问这是不是bug

set term wxt
set title "My title "
set polar
set angles degrees

set grid polar 360
set size square
set style data lines
set key top left

unset border

set grid ls 0
set linetype 1 lc rgb 'red' lw 2 pt 7 ps 2

M=2.2
npoints = 7

minima = "0 0 0 0 0 0 0" # adjust and add more as necessary
maxima = "1 1 1 1 1 1 1"

a(n) = 360./npoints*n
amin(n) = 0.0 + word(minima,int(n))
amax(n) = 0.0 + word(maxima,int(n))

do for [i=1:npoints] {
    set arrow i from 0,0 to first M*cos(a(i)), M*sin(a(i))
    set label i sprintf("M%.f",i) at M*cos(a(i)),M*sin(a(i)) \
        center offset char 1,1
}

set object 1 circle at 0,0 size M fillc rgb "yellow" behind
set object 2 circle at 0,0 size 1 fillc rgb "white" behind

set xrange [0:1]
set yrange [0:1]

set xtics axis 0,0.5,M
unset ytics

set rrange [0:M]

set rtics (""0,""0.25,""0.5,""0.75,"{/:Bold Limit}"1,""1.25,""1.50,""1.75,""2)
set rtics scale 0 format ''

set style fill transparent solid 0.5
set style function filledcurves y1=0.5
set grid noxtics nomxtics noytics nomytics front

plot '-' us (a()):((-amin())/(amax()-amin())) \
        w filledcurve closed lt 1 title "AAA",\
     '-' us (a()):((-amin())/(amax()-amin())) \
         w filledcurve closed lt 2 title "BBB"

1 2.1
2 1
3 0.1
4 0.5
5 0.5
6 0.1
7 0.5
EOF
1 2.2
2 0.9
3 0.9
4 0.2
5 0.3
6 0.1
7 1.8
EOF