So far I'm pleased with matplotlib and python. I'm a pretty new user and
find the coding very rapid and the ability to glue different database and
statistical programs together pretty slick. I have a question.
I am retrieving data from a database using an ODBC connection. When I print
the result set, "sql_result_set", looks like this, a list of tuples (I
[(31773, 60.691), (31772, 61.991), ...and so on... (31774, 60.779)]
Each tuple contains the X value and Y value for each coordinate on the line
plot I wish to make.
After experimentation, I found that I could extract 2 vectors, one for x and
one for y, by doing this:
x_value = [thisrow for thisrow in sql_result_set]
y_value = [thisrow for thisrow in sql_result_set]
and then fed the result into plot
Now this works, but seems an inefficient way to do this.
Is there a way to force the plot(x,y) command to recognize my
"sql_result_set" as a list of x,y tuples, instead of splitting the set into
two vectors? This would seem a natural way for plot to operate. Somehow I
think the "apply" notation, "*" or "**", might do this, but I'm stuck.
Thanks for your ideas. Please let me know if I missed the obvious.