Browse Source

remove matplot deprecation warning

epsylon 9 months ago
parent
commit
fef6fddf69
1 changed files with 3 additions and 0 deletions
  1. 3 0
      collatz/main.py

+ 3 - 0
collatz/main.py

@@ -10,6 +10,8 @@ Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 import os, sys
 import matplotlib.pyplot as plt
 
+plt.rcParams.update({'figure.max_open_warning': 0})
+
 class Collatz(object):
     def __init__(self):
         self.m=False
@@ -39,6 +41,7 @@ class Collatz(object):
         ax = fig.add_subplot(111, facecolor='black')
         for t in self.tree:
             ax.scatter(self.tree.index(t)+1, t, color="red", s=2)
+        plt.clf() # removing matplot future warning
         header = '"Tree" for number '+str(self.root)+' to becomes 1'
         plt.title(header)
         plt.ylabel('Number(s)')