I am trying to plot a candlestick using an array. I am not successful and get an error message "warning: Skipping data file with no valid points". How can I plot the candlestick using an array. This is my gnuplot script:
array Candle[6]
Candle[1] = 1
Candle[2] = 1
Candle[3] = 1000
Candle[4] = 2000
Candle[5] = 3000
Candle[6] = 4000
set datafile separator whitespace
set xrange[0:10]
set yrange[0:5000]
plot Candle using Candle[1]:Candle[3]:Candle[2]:Candle[6]:Candle[5] with candlesticks lt 3 lw 2 title 'Quartiles' whiskerbars
Note: Let's say I have a file named candle.txt with this data:
1 1 1000 2000 3000 4000
The candlestick is properly plotted when using this command:
plot 'candle.txt' using 1:3:2:6:5 with candlesticks lt 3 lw 2 title 'Quartiles' whiskerbars
Although I don't understand what you want to do with a single candlestick and why it has to be from an array instead of a text file or inline datablock, but what about the following?
You've been close. Mind the parentheses in the plot command.
Script:
### plot single candlestick from array
reset session
array Candle[6] = [1, 1, 1000, 2000, 3000, 4000]
set xrange[0:2]
set offsets graph 0.1, graph 0.1, graph 0.1, graph 0.1
set boxwidth 0.5 absolute
plot Candle every ::::0 u (Candle[1]):(Candle[3]):(Candle[2]):(Candle[6]):(Candle[5]) \
w candlesticks lt 3 lw 2 title 'Quartiles' whiskerbars
### end of script
Result: