Note that there are some explanatory texts on larger screens.

plurals
  1. POFigure GUI freezing
    text
    copied!<p>I am fairly new in python, and I am trying to have a plot, based on data stored in a file. This file may be updated at any time, so I am trying to make the drawing updated every 3 seconds (so I don't use all the CPU). My problem is that the GUI freezes after the lunch.</p> <pre><code>#!/usr/bin/python # _*_ coding: utf8 _*_ import matplotlib.pyplot as plt import numpy as np import time plt.ion() plt.figure() i=0 while 1: taille=0 fichier=np.loadtxt('data/US.SAVE') fichier1=np.loadtxt('data/cond.SAVE') taille1=np.size(fichier1[:,1]) taille=np.size(fichier[:,1]) min=min(fichier[0,0],fichier1[0,0]); fichier[:,0]=fichier[:,0]-min fichier1[:,0]=fichier1[:,0]-min if (taille != taille1) : printErrors("TAILLE DE FICHIERS DIFFERENTES") nb_chunks=np.size(fichier1[1,:]) nb_inputs=np.size(fichier[1,:]) plt.subplot(3,1,1) plt.bar(fichier[:,0],fichier[:,1],align='center',width=0.0001, facecolor='b', label="US") x1,x2,y1,y2 = plt.axis() x1=x1-0.0001 plt.axis([x1, x2, y1, 1.2]) plt.legend(ncol=3,prop={'size':9}) plt.title("US ") plt.ylabel('Activation') plt.xlabel('Time') plt.subplot(3,1,2) plt.bar(fichier1[:,0],fichier1[:,1],align='center',width=0.0001, facecolor='b', label="response") plt.axis([x1, x2, y1, 1.2]) plt.legend(ncol=3,prop={'size':9}) plt.title("Response ") plt.ylabel('Activation') plt.xlabel('Time') plt.subplot(3,1,3) plt.bar(fichier[:,0]-fichier1[:,0],fichier1[:,1],align='center',width=0.0001, facecolor='b', label="Error") plt.axis([x1, x2, y1, 1.2]) plt.legend(ncol=3,prop={'size':9}) plt.title("Error") plt.ylabel('Activation') plt.xlabel('Time') plt.draw() name1='data/Conditionnement.eps' plt.savefig(name1,dpi=256) plt.draw() del fichier,fichier1,min i=i+1 time.sleep(3) plt.show() </code></pre> <p>I did not find any other topic on a file based drawing.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload