Skip to content

Commit 0063174

Browse files
authored
Merge pull request #358 from DiODeProject/subplotwarning
Suppress matplotlib deprecation warning in nested multicontrollers
2 parents 39e81d1 + 16e26d9 commit 0063174

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

mumot/views.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
symbols,
3333
)
3434
from sympy.parsing.latex import parse_latex
35-
from warnings import warn
35+
from warnings import warn, catch_warnings, simplefilter
3636

3737
from . import (
3838
consts,
@@ -544,11 +544,13 @@ def _plot(self, _=None) -> None:
544544
else:
545545
# subplotNum = 1
546546
for func, subPlotNum, axes3d in self._controller._replotFunctions:
547-
if axes3d:
548-
# self._figure.add_subplot(self._numRows, self._numColumns, subPlotNum, projection = '3d')
549-
plt.subplot(self._numRows, self._numColumns, subPlotNum, projection='3d')
550-
else:
551-
plt.subplot(self._numRows, self._numColumns, subPlotNum)
547+
with catch_warnings():
548+
simplefilter("ignore")
549+
if axes3d:
550+
# self._figure.add_subplot(self._numRows, self._numColumns, subPlotNum, projection = '3d')
551+
plt.subplot(self._numRows, self._numColumns, subPlotNum, projection='3d')
552+
else:
553+
plt.subplot(self._numRows, self._numColumns, subPlotNum)
552554
func()
553555
plt.subplots_adjust(left=0.12, bottom=0.25, right=0.98, top=0.9, wspace=0.45, hspace=None)
554556
# plt.tight_layout()

0 commit comments

Comments
 (0)