Plot Multiple List by concatenating to a string?

Hi again,

This is slightly similar to my previous post, however using lists, not
dictionaires.

So, I have a for loop that produces two list, as follows:

Hours = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23']
and
Values = ['5.8', '5.76', '5.81', '5.72', '5.69', '5.88', '5.77', '5.64',
'6.78', '5.82', '6.74', '5.45', '5.61', '5.77', '10.02', '5.88', '5.77',
'5.64', '6.78', '5.82', '6.74', '5.45', '5.61']

So as you can see for each hour a value is given, now plotting this is
simple, its just plot(Hours, Values).

However, this is generated from a for loop and there could be anything from
1 to 1000 of the "Hours" and "Values" lists (The "Hours" list is always the
same), and I would like to plot all on the same axis.

Is there a way to build a "plot string", and then plot the string once the
for loop has finished. i.e

PlotString = ""
for item in AList:
      Hours = item[0]
      Values = item[1]
      PlotString += Hours, Values

plot(PlotString)

Now I know the above does not work, but it is purely to describe where I am
trying to go.

Thank you for all your help.

···


View this message in context: http://www.nabble.com/Plot-Multiple-List-by-concatenating-to-a-string--tp18751780p18751780.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

What gain are you looking for over your lists,
which seems an efficient approach?

You realize plot accepts 2d objects, right?
http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-plot
So you can just make a list of lists for the dependent variables.

Cheers,
Alan Isaac

···

On Thu, 31 Jul 2008, stuartornum apparently wrote:

Is there a way to build a "plot string", and then plot the
string once the for loop has finished.

Hi Alan,

Thanks for the reply.

I have literally in the past few days started using matplotlib, and python
for about 3 weeks prior.

So I am not at all up-to-date with all its functionality.

In regards to 2D objects, I have no idea.

Thanks again

Alan G Isaac wrote:

···

On Thu, 31 Jul 2008, stuartornum apparently wrote:

Is there a way to build a "plot string", and then plot the
string once the for loop has finished.

What gain are you looking for over your lists,
which seems an efficient approach?

You realize plot accepts 2d objects, right?
http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-plot
So you can just make a list of lists for the dependent variables.

Cheers,
Alan Isaac

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


View this message in context: http://www.nabble.com/Plot-Multiple-List-by-concatenating-to-a-string--tp18751780p18757080.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

E.g., a list of lists.

list1 = [0,1,2]
list2 = [3,4,5]
listoflists = [ list1, list2 ]

So you can put all your independent variables into a list
of lists, and plot them at one go against your list of times.
(Assuming common lengths.)

hth,
Alan Isaac

···

On Thu, 31 Jul 2008, stuartornum apparently wrote:

In regards to 2D objects, I have no idea.