Cloud Stack Ninja

I´ve written a Python code on PyCharm, and part of the code´s job is to plot data using matplotlib.

Everything is fine if I run the code on the IDLE, but if I execute the code as py.file alone, the figure can only be updated when I close the current plot. So what causes this difference between executing a code in IDE and as py.file alone?


The section related to the data plotting is updated down below, the rest part of the code must not be shared at any public website, so I can only describe it. It´s just about calculations and simulations. The main problem is not in that part.

for model_time in range(0, len(t)):
    if (model_time + 1) % 3000 == 0:
        plt.plot(x_nodes, concentration_matrix[:, 0])
        plt.axis([x_nodes[0], x_nodes[-1], 0, 1.2])

I just wanted to plot the modeled data after some specific time was elapsed. I ran this on PyCharm by using 'execute selection in Python console' or 'Run file in Python console', and the figure (plot) can be automatically updated. But when I run the same file via 'cmd', the plot must be closed manually by hand in the first place, and then the next plot can be shown. After that I must close the current plot again, then a new plot comes out.......This is a catastrophe for someone who won´t execute the file on PyCharm.

Read more here:

Content Attribution

This content was originally published by michael at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: