1
votes

I'm playing around with trying to create a Box and Whisker plot with gnuplot, to output into a latex document. I keep having the following error:

"test.gp", line 10: undefined variable: using

My code is below:

set terminal latex
set output "test.tex"
set style data boxplot
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7

set datafile separator ","
set xrange[0:6] 
set yrange[0.000:1.000] 
plot "test.csv" using 1:3:2:6:5:xticlabels(7) with candlesticks notitle whiskerbars, using 1:4:4:4:4 with candlesticks lt -1 notitle

And here is the CSV file that I'm using:

1,0.381768,0.386109,0.423836,0.381768,0.42965,"0.3", 2,0.400131,0.446271,0.47671,0.400131,0.481733,"0.4", 3,0.442295,0.443961,0.512071,0.442295,0.58654,"0.5", 4,0.464072,0.502773,0.516437,0.464072,0.589175,"0.6", 5,0.460358,0.468294,0.479633,0.460358,0.562291,"0.7",

Is anybody able to help me figure out what's wrong

1
BTW are you interested in plotting the candlesticks or boxplots?Zahaib Akhtar
What's the difference? I've mainly been following examples I found online and they use candlesticks.AdmiralJonB
Well, with boxplots you just specify your column of data and the mean, stdev will be calculated. You also have the options to show outliers in different styles. Whereas with candlesticks you explicitly need to specify the five point summary i.e. min, 25%ile, median, 75%ile and max. So if you are just planning to get candlesticks, which is also evident from your data then set style data boxplot and set style boxplot outliers pointtype 7 are not needed.Zahaib Akhtar
Thanks, wish I knew that before I wrote the code to calculate it all, lol.AdmiralJonB

1 Answers

2
votes

In your plot command, you are missing the second '',Try this:

plot "test.csv" using 1:3:2:6:5:xticlabels(7) with candlesticks notitle whiskerbars, '' using 1:4:4:4:4 with candlesticks lt -1 notitle