我有以下数据:
ora_data01 484 484 486 490 620
ora_data02 650 651 651 671 741
ora_data03 730 768 769 773 773
ora_data04 525 525 525 541 605
ora_data05 472 547 559 635 643
ora_data06 285 377 404 494 609
ora_data07 267 353 387 453 585
ora_data08 308 434 469 526 581
local_backup 118 442 147 156 136
我想创建一个直方图,我写了下面的脚本:
set terminal png truecolor
set output "moneta_FS.png"
set grid
set style data histograms
set style fill solid 1.00 border -1
plot "moneta_fs_2014.txt" using 2:xtic(1) title "Jan-14 data growth(Gb)", "moneta_fs_2014.txt" using 5 title "Feb-14 data growth(Gb)",
'' using 6 title "Mar-14 data growth(Gb)", '' using 7 title "Apr-14 data growth(Gb)", '' using 8 title "May-14 data growth(Gb)"
并且给我以下错误:
gnuplot> plot "moneta_fs_2014.txt" using 2:xtic(1) title "Jan-14 data growth(Gb)", "moneta_fs_2014.txt" using 5 title "Feb-14 data growth(Gb)",
^
line 0: function to plot expected
gnuplot> '' using 6 title "Mar-14 data growth(Gb)", '' using 7 title "Apr-14 data growth(Gb)", '' using 8 title "May-14 data growth(Gb)"
^
line 0: invalid command
答案 0 :(得分:1)
如果这是您的实际脚本,则此处存在行格式问题:
plot "moneta_fs_2014.txt" using 2:xtic(1) title "Jan-14 data growth(Gb)", "moneta_fs_2014.txt" using 5 title "Feb-14 data growth(Gb)",
'' using 6 title "Mar-14 data growth(Gb)", '' using 7 title "Apr-14 data growth(Gb)", '' using 8 title "May-14 data growth(Gb)"
plot命令的第一行以回车符结束,这是命令分隔符,因此GNUPlot不知道如何处理第二行。您可以(a)将这些合并为一行,或者(b)使用反斜杠(\
)将命令分散到多行:
plot "moneta_fs_2014.txt" using 2:xtic(1) title "Jan-14 data growth(Gb)", \
"moneta_fs_2014.txt" using 5 title "Feb-14 data growth(Gb)", \
'' using 6 title "Mar-14 data growth(Gb)", \
'' using 7 title "Apr-14 data growth(Gb)", \
'' using 8 title "May-14 data growth(Gb)"
我在本地运行它似乎工作正常。