Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot histogram: line 0: Too many columns in using specification

I want to create a histogram of a file that contains :

1 144 12.54
2 564 02.34
3 231 01.23
4 452 07.12

and what I use for that purpose in my script is :

gnuplot << EOF
            set terminal gif
            set terminal postscript eps color enhanced
            set output "diagramma";
            set title 'Diagramma'
            set key off
            set style data histogram
            set style histogram cluster gap 1
            set style fill solid border -1
            set boxwidth 0.9
            set autoscale
            set xlabel "May"
            plot 'finalsumfile' using 1:2 with histogram, 'finalsumfile' using 1:3 with histogram

EOF

So I want the first column as x coordinate and the second and third columns as y.

BUT when I run my script occurs this error:

line 0: Too many columns in using specification 

What am I doing wrong?

like image 616
Gregory Maris Avatar asked Aug 16 '26 05:08

Gregory Maris


1 Answers

try:

 plot 'finalsumfile' using 2:xticlabels(1) with histogram

Histograms typically only take 1 column of data, which the "x-value" being implicitly incremented by one each time starting from 0. To set explicit x labels, you need to use xticlabels which takes the string in the given column and uses that as the label.

like image 138
mgilson Avatar answered Aug 18 '26 20:08

mgilson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!