Plotting multiple datasets with gnuplot

Rob Garrett rgagarrett at
Fri Oct 9 11:36:45 CEST 2009

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:

I don't know how many plots I'll be wanting to plot, but the number
will be roughly 15-20 and it seems ridiculous to have to hand-write
individual setup for each plot when I should be able to just loop
through the datasets and add them to gnuplot automatically.

Any help would be much appreciated!


PS  mulitplot isn't the solution - this places plots literally on top
of each other, it doesn't plot different sets of data on the same axes.

More information about the Python-list mailing list