1

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 !

lisprogtor
  • 5,677
  • 11
  • 17

1 Answers1

0

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

Ethan
  • 13,715
  • 2
  • 12
  • 21
  • Thank you very much Ethan. However, if I simply add your line to my script, it does not work. I will do more search. – lisprogtor Mar 19 '20 at 21:47
  • Hmm. You did not say what version of gnuplot you are using. If you are using an old version, it might work to say instead `set style fill solid border lc "black"`. But this will add a border in addition to coloring the whiskers. – Ethan Mar 19 '20 at 23:44
  • Thank you Ethan ! I am using "gnuplot 5.2 patchlevel 2" – lisprogtor Mar 20 '20 at 06:04
  • I updated my gnuplot, and it is now working as expected. Thank you very much Ethan !!! – lisprogtor Mar 20 '20 at 06:09