无法使用 gnuplot 绘制条形图

Unable to plot bargraph using gnuplot

我在使用 gnuplot 绘制条形图时遇到问题。我在 Windows 7 上使用 gnuplot 4.6 版。我看到一条错误消息“;”预期。

逻辑如下:

# bar graph
#set title "Programming language"
set xlabel "Programming"
set ylabel "Execution time"
set auto x
set yrange [0:120]
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.9
set xtic scale 0
plot 'bar-graph.dat' using 2:xtic(1) title "Python" col fc rgb "#4671d5", '' u 3 title "Java" col fc rgb "#ff0000", '' u 4 title "C++" col fc rgb "#f36e00"
                                                                                                                              ^
         ';' expected

这是数据:

"Python"         50   70     66.5
"Java"           30   50     48
"C++"            10   20    14.8

我想绘制一个类似于 Microsoft Excel 的连接条形图。请让我知道我遗漏了什么。

谢谢, 阿南德

您使用了错误的语法来设置线条颜色。没有 col 选项。只需使用 lc rgb "#467165":

plot 'bar-graph.dat' using 2:xtic(1) title "Python" lc rgb "#4671d5", '' u 3 title "Java" lc rgb "#ff0000", '' u 4 title "C++" lc rgb "#f36e00"

并且请给你的情节更有意义的标签。有一个 'python' 组和一个酒吧 'python' 是不言自明的。