PDA

View Full Version : Draw Bar Graph by using GNUPlot



tzeronone
February 8th, 2013, 05:06 AM
For example, I have a file called "data.txt". And the content is:

Iker_Casillas 31
Sergio_Ramos 26
Karim_Benzema 25I would like to plot the data into a bar graph. So far, here is my code:

set boxwidth 1 relative
set style data histograms
set style fill solid 1.0 border -1
set datafile separator " "
plot '0/0_0.0.txt' using 2:xticlabels(1) notitle
set terminal jpeg truecolor font small size 600,500
set output 'try.jpeg'
replotHowever, due to the length of the name, it will overlapped with each other. Any idea how to solve this? And I would like to add value label on top of each bar. Any help? Thank you.