PyQt / Matplotlib:如何在窗口中重绘/更新3D表面图?

时间:2018-09-18 05:21:14

标签: python matplotlib pyqt pyqt4

在执行PyQt程序时,更新的图形将绘制在第一个图形上。我希望该图形显示在QWidget中显示的Window中。以下想法适用于3D线以及点图,但不适用于用于表面图。

22:04:30.866 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.web.servlet.support.SessionFlashMapManager'
22:04:30.870 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
22:04:30.871 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.web.servlet.support.SessionFlashMapManager'
22:04:30.871 [main] DEBUG o.s.t.w.s.TestDispatcherServlet - Unable to locate FlashMapManager with name 'flashMapManager': using default [org.springframework.web.servlet.support.SessionFlashMapManager@1f7076bc]
22:04:30.871 [main] DEBUG o.s.t.w.s.TestDispatcherServlet - Published WebApplicationContext of servlet '' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.]
22:04:30.871 [main] INFO  o.s.t.w.s.TestDispatcherServlet - FrameworkServlet '': initialization completed in 38 ms
22:04:30.872 [main] DEBUG o.s.t.w.s.TestDispatcherServlet - Servlet '' configured successfully
22:04:30.978 [main] DEBUG o.s.t.w.s.TestDispatcherServlet - DispatcherServlet with name '' processing POST request for [/myapibase/v1/clients]
22:04:30.981 [main] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /myapibase/v1/clients
22:04:30.982 [main] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Did not find handler method for [/myapibase/v1/clients]
22:04:30.982 [main] WARN  o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/myapibase/v1/clients] in DispatcherServlet with name ''
22:04:30.983 [main] DEBUG o.s.t.w.s.TestDispatcherServlet - Successfully completed request

MockHttpServletRequest:
         HTTP Method = POST
         Request URI = /myapibase/v1/clients
          Parameters = {}
             Headers = {Content-Type=[application/json]}

             Handler:
                Type = null

               Async:
       Async started = false
        Async result = null

  Resolved Exception:
                Type = null

        ModelAndView:
           View name = null
                View = null
               Model = null

            FlashMap:

MockHttpServletResponse:
              Status = 404
       Error message = null
             Headers = {}
        Content type = null
                Body = 
       Forwarded URL = null
      Redirected URL = null
             Cookies = []

1 个答案:

答案 0 :(得分:0)

您只需要在绘制之前清除轴:

import os, zipfile
import shutil
import os
from os import path


dir_name = 'C:\\Users\\Guest\\Desktop\\OJT\\samples'
destination = 'C:\\Users\\Guest\\Desktop\\OJT\\scanner\\test'
for path, subdirs, files in os.walk(destination):
    for name in files:
        filename = os.path.join(path, name)
        shutil.copy2(filename, destination)

我还添加了一些随机数以使更新可见。这是完整的代码:

def DrawGraph(self, x, y, z):#Fun for Graph plotting
    self.axes.clear() # <<<
    self.axes.plot_surface(x, y, z) #plots the 3D surface plot