Search code examples
colorsgnuplotboxplotcandlesticks

gnuplot: how to set color of the whisker in candlestick?


I am drawing candlestick chart. How do I set color of the whisker to be black? Right now, it is the same as the rest of the box. This is my code so far:

set terminal svg 
set output 'out.svg'
set key off  
set xlabel 'X'
set ylabel 'Y'
set title 'Data'

set xrange [0:4]
set yrange [0:100]
set tics scale 0.5
set xtics nomirror
set ytics nomirror

set style fill solid noborder
set linetype 1 lc rgb 'red'
set linetype 2 lc rgb '#009900' 
set linetype 3 lc rgb 'black' 
set boxwidth 0.75 relative # absolute

plot "data.txt"  using 1:2:4:3:5:($5 < $2 ? 1 : 2)  linecolor variable with candlesticks, "data.txt" using 1:6 with lines lt 3 

Thanks !


Solution

  • The whiskers in a candlestick plot have the same properties as the errorbars in other plots with errorbars. For example

      set bars linecolor "black" linewidth 3
    

    enter image description here