From: Vic W. <vic...@er...> - 2012-07-25 11:06:31
|
Hi All. Apologies for my neophyte question, but I'm a bit new to gnuplot, and I need to get this going this week... I have a data set of test results. The format is very simple: Attempted,5 Passed,4 Failed,1 Skipped,0 I'm trying to put this through gnuplot to get a graph of the results - specifically, I'm trying to return the image from a mod_python module running in Apache. I've got a script that does what I want it to do on the gnuplot command line :- set datafile separator "," set yrange [0:] set style fill solid set terminal gif set xrange [-.5:3.5] attempted_row(x,y)=(x eq "Attempted") ? y:1/0 skipped_row(x,y)=(x eq "Skipped") ? y:1/0 passed_row(x,y)=(x eq "Passed") ? y:1/0 failed_row(x,y)=(x eq "Failed") ? y:1/0 plot results.txt u ($0):(attempted_row(stringcolumn(1),$2)):xtic(1) w boxes lc rgb "blue" ti "Attempted", "" u ($0):(skipped_row(stringcolumn(1),$2)):xtic(1) w boxes lc rgb "yellow" ti "Skipped", "" u ($0):(passed_row(stringcolumn(1),$2)):xtic(1) w boxes lc rgb "green" ti "Passed", "" u ($0):(failed_row(stringcolumn(1),$2)):xtic(1) w boxes lc rgb "red" ti "Failed Now I'm not completely sure how this script works - I cribbed it from a web page and adjusted it to meet my needs. I'm trying to get this running from Gnuplot.py - and it doesn't. I can "g.plot('results.txt')", and I seem to get no response. If I try to put the data directly into g.plot, I get "ValueError: setting an array element with a sequence". I've no idea how to progress - can anyone point me in the right direction, please? Thanks! Vic. |