title: Gnuplot: plotting a wind rose diagram
body: <p>Trying to plot a wind rose diagram <a href="https://en.wikipedia.org/wiki/Wind_rose" rel="nofollow noreferrer">1</a>. Here's the current version:</p>
  
  <pre><code>set terminal pngcairo size 800,800
  set output 'colors.png'
  
  set palette model RGB defined ( 0 '#e3f2fd', 1 '#bbdefb', 3 '#90caf9', 4 '#64b5f6', 5 '#42a5f5', 6 '#2196f3', 7 '#1e88e5', 8 '#1976d2', 9 '#1565c0', 10 '#0d47a1')
  
  set polar
  set size square
  set grid polar front
  set angles degrees
  set grid polar 11.25
  set grid ls 2
  set rrange [0:25]
  
  set_label(x, text) = sprintf("set label '%s' at (22*cos(%f)), (22*sin(%f))     center", text, x, x) #this places a label on the outside
  
  #here all labels are created
  eval set_label(0, "E")
  eval set_label(22.5, "ENE")
  eval set_label(45, "NE")
  eval set_label(67.5, "NNE")
  eval set_label(90, "N")
  eval set_label(112.5, "NNW")
  eval set_label(135, "NW")
  eval set_label(157.5, "WNW")
  eval set_label(180, "W")
  eval set_label(202.5, "WSW")
  eval set_label(225, "SW")
  eval set_label(247.5, "SSW")
  eval set_label(270, "S")
  eval set_label(292.5, "SSE")
  eval set_label(315, "SE")
  eval set_label(337.5, "ESE")
  
  
  
  unset xtics
  unset ytics
  set border 0
  
  plot for [i=-11.25:11.25] 'wind.data' u (22.5*0+i):(($5&gt;0)?$1:''):($5) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*1+i):(($4&gt;0)?$1:''):($4) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*2+i):(($3&gt;0)?$1:''):($3) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*3+i):(($2&gt;0)?$1:''):($2) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*4+i):(($17&gt;0)?$1:''):($17) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*5+i):(($16&gt;0)?$1:''):($16) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*6+i):(($15&gt;0)?$1:''):($15) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*7+i):(($14&gt;0)?$1:''):($14) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*8+i):(($13&gt;0)?$1:''):($13) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*9+i):(($12&gt;0)?$1:''):($12) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*10+i):(($11&gt;0)?$1:''):($11) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*11+i):(($10&gt;0)?$1:''):($10) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*12+i):(($9&gt;0)?$1:''):($9) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*13+i):(($8&gt;0)?$1:''):($8) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*14+i):(($7&gt;0)?$1:''):($7) w p pt 5 ps 2 palette notitle,\
  for [i=-11.25:11.25] '' u (22.5*15+i):(($6&gt;0)?$1:''):($6) w p pt 5 ps 2 palette notitle
  </code></pre>
  
  <p>'wind.data' contains first column - speed (1, 2, 3, 4 etc m/s) and columns for each direction (i.e. angle). See my horrible solution with 'for' loop to draw kind of sectors. So, I'm asking is there a better option? How do I draw sectors/segments?</p>
  
  <p>Current output:</p>
  
  <p><a href="https://i.stack.imgur.com/J9FBJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J9FBJ.png" alt="enter image description here"></a></p>