Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71380

Re: Plotting multiple datasets with gnuplot

Newsgroups comp.lang.python
Date 2014-05-12 01:56 -0700
References <0c9f0c8b-30fb-4358-aed2-a5ed4dcdcb5c@d10g2000yqh.googlegroups.com> <mailman.1075.1255083217.2807.python-list@python.org>
Message-ID <9d24b871-0553-45f5-b9a4-77fc82d23cb3@googlegroups.com> (permalink)
Subject Re: Plotting multiple datasets with gnuplot
From s.c.wouters@gmail.com

Show all headers | View raw


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@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!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Plotting multiple datasets with gnuplot s.c.wouters@gmail.com - 2014-05-12 01:56 -0700

csiph-web