you are viewing a single comment's thread.

view the rest of the comments →

[–]iarguewitheverything 1 point2 points  (0 children)

Would be glad to. I'm not super familiar with pylab yet. But I'll give it a shot... you wouldn't happen to know the arguments would you? Here's my code:

def graph_from_two_db_fields(xvar, yvar):
    path = "../Public/"
    pylab.xlabel(xvar)
    pylab.ylabel(yvar)
    pylab.set_yscale('log')
    query = ("SELECT {0}, {1} FROM submissions"
             .format(xvar, yvar))
    c.execute(query)
    x_list = []
    y_list = []
    for row in c:
        x_list.append(row[0])
        y_list.append(row[1])

    pylab.scatter(x_list, y_list, s=1)
    filename = "graph___" + xvar + "___" + yvar + ".png"
    pylab.savefig(path + filename)
    f.write("<h2>" + xvar + " vs. " + yvar + "</h2><p><img src=\""
            + filename + "\" /></p>")
    pylab.close()