python 使用matplotlib,折线图弹出之后,可以不关闭折线图弹窗 让后续代码继续运行吗?

# 这是代码的一小部分
# 统计总分数段 并 画出折线图
    def statisticalTotal(self):
        sectionList = [0,0,0,0,0]
        for i in self.stuArr:
            sumgrade = i.courseGrade[6]
            if sumgrade < 350:
                sectionList[0]+=1
            elif 350 <= sumgrade < 400:
                sectionList[1]+=1
            elif 400 <= sumgrade < 450:
                sectionList[2]+=1
            elif 450 <= sumgrade < 500:
                sectionList[3]+=1
            elif 500 <= sumgrade <= 550:
                sectionList[4]+=1

        print(sectionList)
        print(sum(sectionList))
        plt.plot(['350分以下','350-400分','400分-450分','450-500分','500-550分']
                 ,[sectionList[0],sectionList[1],sectionList[2],sectionList[3],sectionList[4]])
        plt.show()

那你不要用阻塞的方式弹窗,改为非阻塞的方式
在plt.show之前先执行plt.ion(),改为交互式

默认matplotlib plt.show()是阻塞型的,如果你想要程序继续运行,最后在展示图,那可以把plt.show()放在程序尾呢