mirror of
https://github.com/clearml/clearml
synced 2025-03-04 02:57:24 +00:00
Fix remove deprecation warning with matplotlib 3.1
This commit is contained in:
parent
c07c45d2b3
commit
5ee6425b4f
@ -8,12 +8,27 @@ import math
|
|||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
import matplotlib.dates
|
import matplotlib.dates
|
||||||
|
from matplotlib import __version__ as matplotlib_version
|
||||||
try:
|
try:
|
||||||
from matplotlib.patches import FancyBboxPatch
|
from matplotlib.patches import FancyBboxPatch
|
||||||
except ImportError:
|
except ImportError:
|
||||||
FancyBboxPatch = None
|
FancyBboxPatch = None
|
||||||
|
|
||||||
|
|
||||||
|
def check_maplotlib_max_version(ver_maj, ver_min):
|
||||||
|
"""
|
||||||
|
return True if check_maplotlib_version is lower than specified version
|
||||||
|
"""
|
||||||
|
parts = matplotlib_version.split('.')
|
||||||
|
if not parts:
|
||||||
|
return False
|
||||||
|
if parts[0] < str(ver_maj):
|
||||||
|
return True
|
||||||
|
if len(parts) > 1 and parts[1] < str(ver_min):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check_bar_match(old_bar, new_bar):
|
def check_bar_match(old_bar, new_bar):
|
||||||
"""Check if two bars belong in the same collection (bar chart).
|
"""Check if two bars belong in the same collection (bar chart).
|
||||||
|
|
||||||
@ -368,7 +383,10 @@ def get_spine_visible(ax, spine_key):
|
|||||||
"""Return some spine parameters for the spine, `spine_key`."""
|
"""Return some spine parameters for the spine, `spine_key`."""
|
||||||
spine = ax.spines[spine_key]
|
spine = ax.spines[spine_key]
|
||||||
ax_frame_on = ax.get_frame_on()
|
ax_frame_on = ax.get_frame_on()
|
||||||
spine_frame_like = spine.is_frame_like() if hasattr(spine, 'is_frame_like') else True
|
if check_maplotlib_max_version('3', '1'):
|
||||||
|
spine_frame_like = spine.is_frame_like() if hasattr(spine, 'is_frame_like') else True
|
||||||
|
else:
|
||||||
|
spine_frame_like = True
|
||||||
if not spine.get_visible():
|
if not spine.get_visible():
|
||||||
return False
|
return False
|
||||||
elif not spine._edgecolor[-1]: # user's may have set edgecolor alpha==0
|
elif not spine._edgecolor[-1]: # user's may have set edgecolor alpha==0
|
||||||
|
Loading…
Reference in New Issue
Block a user