使用gnuplot绘制图形

时间:2012-08-07 08:53:00

标签: linux gnuplot

htmlResponseBytes 39842 397888
cssResponseBytes 109265 108988
imageResponseBytes 205179 206662
javascriptResponseBytes 468573 476888
otherResponseBytes 4326 4378

我想使用gnuplot绘制条形图这个数据。第1列应出现在x轴上,第2列和第3列应使用条形图绘制。第二列今天应该有传说,第三列应该有昨天的传奇。此值也应该出现在每个柱子的顶部。

我试过这个

   reset
   dx=5.
   n=2
   total_box_width_relative=0.75
   gap_width_relative=0.1
   d_width=(gap_width_relative+total_box_width_relative)*dx/2.
   reset
   set term png truecolor
   set output "profit.png"
   set xlabel "Year"
   set ylabel "Profit(Million Dollars)"
   set grid
   set boxwidth total_box_width_relative/n relative
   set style fill transparent solid 0.5 noborder
   plot "profit.dat" u 1:2 w boxes lc rgb"green" notitle,\
   "profit.dat" u ($1+d_width):3 w boxes lc rgb"red" notitle

Copied this code from here, works fine for his data file but doesn't work for mine data file pasted at the top

1 个答案:

答案 0 :(得分:0)

这个怎么样:

set style data histogram 
set style histogram cluster gap 1
set xtics rotate by 90
set style fill solid
plot 'test.dat' using 2:xtic(1) lc rgb "blue", \
     '' using 3