Problem when drawing plots with matplotlib



  • Hello,

    I have my interface which contained 4 tabs. In every tab, I have a button called generate graph which generates graph when it is clicked. I can plot the first figure but when I try to plot the second, the interface crashes and no plot is represented. I used the library matplotlib to do that. Here is my code :

    fig = plt.figure(self.numFiguresPlot2_1)
    fig.canvas.set_window_title(self.DropDownListDisplaySector2_1.currentText())
     x = np.arange(0, self.stockParam.nTotZones, 1);
    y = pd.to_numeric(matrix4["Price"])
    print("Moyenne = ")
    print(y.mean(0))
    z = pd.to_numeric(matrix4["Adjust"]*y)/100 + y
     if(firstPlot):
    price = plt.plot(x, y, label = ("Price"))
     shadowPrice = plt.plot(x, z, label = ("Price + adjust for iteration "+self.DropDownListDisplayIter2_1.currentText()))
    plt.legend()
    plt.draw()
    plt.show()
    

    Can you help me ?
    Thanks.



  • @EJWA I see nothing Qt related in your question, did you post to the right forum?



  • Oh yes, it is a problem with matplotlib. I must search for another forum.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.