Search code examples
gnuplotspider-chart

Pattern Style for first array for Spider Chart is missing


When I you run these instructions:

array Array001=[97,45,15,42,22,31]
array Array002=[53,22,76,76,53,12]
array Array003=[12,14,43,44,98,75]
set datafile separator comma
set style data spiderplot
set term windows
unset xtics; unset ytics; unset x2tics; unset y2tics
set spiderplot
set grid spider  back
set grid xtics  back
set grid noytics
set xrange [-1.2:1.2]
set yrange [-1.2:1.2]
set border 0
set colorsequence classic
set title "{/Tahoma=20 Adventure Time}" textcolor rgb "0xE25822" rotate by 0
set key inside top right opaque fc rgb "0xFFFFFF"
set style spiderplot fill pattern 5 border pt 6 ps 2
set for [a=1:7] paxis a range [11.0000:99.0000]
set for [b=1:1] paxis b tics
plot for [d=1:|Array001|] Array001 using (Array001[d]) lc 1,keyentry with spiderplot lc 1 title "Orc",newspiderplot,for [e=1:|Array002|] Array002 using (Array002[e]) lc 2,keyentry with spiderplot lc 2 title "Wizard",newspiderplot, for [f=1:|Array003|] Array003 using (Array003[f]) lc 3,keyentry with spiderplot lc 3 title "Archer"

I get this chart:Spider chart, first pattern is missing

For the first data point\array, the pattern on the chart itself is "blank", but the key is showing the "correct" one. Other arrays show the same pattern on the chart vs key.

Why is the pattern for the first array different on the chart vs the key?

Roberto


Solution

  • The program apparently takes the "pattern" (as opposed to "solid") correctly from the command set style spiderplot fillstyle pattern 5 but then ignores or is inconsistent in applying the pattern number from that style template.

    Work-around:

    If the fillstyle is given in the plot command itself, both the "pattern" property and the pattern number are applied correctly. So you can modify your plot command to

    plot for [d=1:|Array001|] Array001 using (Array001[d]) lc 1 fs pattern 5, \
         keyentry with spiderplot lc 1 title "Orc", \
         newspiderplot, \
         for [e=1:|Array002|] Array002 using (Array002[e]) lc 2 fs pattern 5, \
         keyentry with spiderplot lc 2 title "Wizard", \
         newspiderplot, \
         for [f=1:|Array003|] Array003 using (Array003[f]) lc 3 fs pattern 5, \
         keyentry with spiderplot lc 3 title "Archer"
    

    enter image description here

    Note: The diagonal direction of the pattern lines in the key entries are backwards. I have no explanation or fix for that. Maybe you could give an explicit fillstyle also on each of the keyentry lines of the plot command, and find a matching pattern even if it is numerically different?