En Fri, 09 Oct 2009 06:36:45 -0300, Rob Garrett <rgagarrett at gmail.com>
escribió:
> I'm trying to get gnuplot to display multiple data series on a single
> plot using gnuplot in python. I've searched around and haven't found
> a solution to how to do this when I have a variable-length list of
> plots to add.
>> For example, the following code will work:
>> plotData1 = Gnuplot.PlotItems.Data(data1, title="title1")
> plotData2 = Gnuplot.PlotItems.Data(data2, title="title2")
> g.plot( plotData1, plotData2 )
>> [I've removed the rest of the code for clarity]
>> But how can I do the following instead:
>> data = []
> ...
> # Populate data
> ...
> plots = []
> for dataSet in data:
> plots.append(dataSet)
> g.plot(plots)
g.plot(*plots) should work; it's like calling g.plot(plots[0], plots[1],
plots[2]...)
See http://docs.python.org/reference/expressions.html#calls for the gory
details.
--
Gabriel Genellina