1
votes

I'm seeing an issue while plotting the bar graph using gnuplot. Im using gnuplot version 4.6 on Windows 7. I'm seeing an error message ";" expected.

Here is the logic:

# 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

Here is the data:

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

I wanted to plot a joined bar graph similar to Microsoft Excel. Please let me know what I'm missing.

Thanks, Anand

1

1 Answers

0
votes

You are using the wrong syntax to set the line color. There is no col option. Just use 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"

enter image description here

And please give your plot more meaningful labels. Having a 'python' group with a bar 'python' isn't self-explaining.