在没有输入文件的情况下直接在 gnuplot 中绘制条形图

plotting bar chart in gnuplot directly without input file

我正在关注 plot bar graphs in Gnuplot,但我无法绘制我的数据。它应该是这样的

这是我的代码

!/usr/bin/gnuplot -persist

  
set boxwidth 0.5
set style fill solid

plot  (1,"label1",664;2,"label2",331) using 1:3:xtic(2) with boxes

错误

plot  (1,"label1",664;2,"label2",331) using 1:3:xtic(2) with boxes
                     ^
"./test.sh", line 10: ')' expected

使用数据块保存在线数据

$data <<EOD
1 "label" 664
2 "label2" 331
EOD

set boxwidth 0.5
set style fill solid

plot  $data using 1:3:xtic(2) with boxes