From: zhangwei02 <zha...@ba...> - 2009-11-18 10:28:44
|
Hi I use gnuplot-py ,load a file to draw a graph: Code: import Gnuplot, Gnuplot.funcutils g = Gnuplot.Gnuplot(debug=1) g.title('a example') # (optional) g('set timefmt "%Y%m%d"') g('set xlabel "Date"') g('set format x "%Y%m%d"') #---------------- bug? g('set ylabel "JobNum"') g('set xtics rotate') g('set terminal png font "fonts/msyh.ttf" 12') # add ! g('set output \'graph_1.png\'') # add! filename='hadoop.data' thefile1 = Gnuplot.File(filename, using = (1,2), with_='lines') g.plot(thefile1) the data file's 1st column is date string. It execute as this: gnuplot> set terminal x11 gnuplot> set title "a example" gnuplot> set timefmt "%Y%m%d" gnuplot> set xlabel "Date" gnuplot> set format x "%Y%m%d" gnuplot> set ylabel "JobNum" gnuplot> set xtics rotate gnuplot> set terminal png font "fonts/msyh.ttf" 12 gnuplot> set output 'graph_1.png' gnuplot> plot "hadoop.data" using 1:2 with lines gnuplot: unable to open display '' gnuplot: X11 aborted. line 0: Bad format character the graph output is empty, but I execute it ok in gnuplot. So is that a bug? Or how to set the output's format as date. Thanks! |