Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem when drawing plots with matplotlib

Problem when drawing plots with matplotlib

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 728 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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.

    E 1 Reply Last reply
    0
    • ? A Former User

      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.

      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

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

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved