Plotting multiple datasets with gnuplot
s.c.wouters at gmail.com
s.c.wouters at gmail.com
Mon May 12 04:56:24 EDT 2014
On Friday, October 9, 2009 12:12:54 PM UTC+2, Gabriel Genellina wrote:
> En Fri, 09 Oct 2009 06:36:45 -0300, Rob Garrett <rgagarrett at gmail.com>
> escribiï¿oe:
>
> > 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
I just spend an hour searching the web for a similar problem and finally found your answer. Thank you, it works great!
More information about the Python-list
mailing list