1

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

theozh
  • 22,244
  • 5
  • 28
  • 72
  • if you put a tag `gnuplot`, people watching the `gnuplot` tag will actually see it, which will increase the chances that you will get an answer ;-) – theozh Aug 24 '23 at 09:32

2 Answers2

0

As a far as I know, spiderplot plotting style was introduced in gnuplot 5.4 and from your command set key opaque fc rgb "#FFFFFF", I assume you are working with gnuplot>=5.4.5.

I haven't used the plotting style spiderplot so far, because I created spiderplots "manually" with older versions (<5.4) of gnuplot. Another question and solution about spider plots: How to make a spider plot in gnuplot?

I would guess that your issue might be a bug in the spiderplot plotting style. It seems that it always starts with fs pattern 0 (empty fill) and might get confused with the keyentries. I haven't tested whether this might be different in gnuplot 5.5.

As a workaround, you can explicitly specify the color and pattern fill, e.g. lc 1 fs pattern 1. Actually, fs pattern 1 makes it a bit hard to read the numbers. Unfortunately, gnuplot has only a limited number of fill patterns.

Script: (working with gnuplot>=5.4.5)

### spiderplot fill bug(?)
reset session
set term wxt size 640,640   # or term windows

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
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 u (Array001[d]) lc 1 fs pattern 1, \
         keyentry w spiderplot lc 1 fs pattern 1 ti "Orc", \
     newspiderplot, \
     for [e=1:|Array002|] Array002 u (Array002[e]) lc 2 fs pattern 4, \
         keyentry w spiderplot lc 2 fs pattern 4 ti "Wizard", \
     newspiderplot, \
     for [f=1:|Array003|] Array003 u (Array003[f]) lc 3 fs pattern 5, \
         keyentry w spiderplot lc 3 fs pattern 5 ti "Archer"
### end of script

Result:

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72
0

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?

Ethan
  • 13,715
  • 2
  • 12
  • 21
  • Thank you Ethan, Yes, the patterns are mirrored. Very weird, I will specify the pattern that I want within my instructions. Roberto – Marionette_66 Aug 24 '23 at 16:33