bash gnuplot 直方图:第 0 行:使用规范中的列太多
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10462546/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gnuplot histogram: line 0: Too many columns in using specification
提问by Gregory Maris
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.
所以我希望第一列作为 x 坐标,第二和第三列作为 y。
BUT when I run my script occurs this error:
但是当我运行我的脚本时会出现这个错误:
line 0: Too many columns in using specification
What am I doing wrong?
我究竟做错了什么?
回答by mgilson
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 xticlabelswhich takes the string in the given column and uses that as the label.
直方图通常只取 1 列数据,其中“x 值”每次从 0 开始隐式递增 1。要设置显式 x 标签,您需要使用xticlabelswhich 获取给定列中的字符串并将其用作标签。

