1

I'm using matplotlib. Code:

for new_counter in range(counter+1):
    print new_counter
    Qbers = final_data[(final_data["Dataset"]==counter) & (final_data["Qber"] > 0) ]
    x1 = Qbers.index.tolist()
    y1 = Qbers["Qber"].tolist()
    Raws = final_data[(final_data["Dataset"]==counter) & (final_data["Raw key"] > 0) ]
    x2 = Raws.index.tolist()
    y2 = Raws["Raw key"].tolist()
    # Two subplots, the axes array is 1-d http://matplotlib.org/examples/pylab_examples/subplots_demo.html
    f, axarr = plt.subplots(2, sharex=True)
    axarr[0].grid()
    axarr[0].plot(x1, y1)
    axarr[0].set_title('Sharing X axis')
    axarr[1].grid()
    axarr[1].plot(x2, y2)
    plt.savefig(str(counter)+'foo.eps')
    plt.clf()

I'm receiving only file with last plot, and with my data I should receive 6 of them. How to fix that? Additional question: How to prevent creation of interactive window with plot?

1

1 Answer 1

1

It looks like you are not generating unique file names. You probably want:

plt.savefig(str(new_counter)+'foo.eps')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.