From 07f7ec6afcc1389c01a70c154c1e4f46be55b690 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 24 Jan 2022 16:35:52 -0500 Subject: [PATCH] FIX: bury import of matplotlib.font_manager We need to ensure that the sub-module matplotlib.font_manager is imported when it is used in SclarFormater, however if we import it at the top level we will get circular imports. closes #22305 --- lib/matplotlib/ticker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 11f43cb8ce6a..e788a96d96d7 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -441,8 +441,9 @@ def __init__(self, useOffset=None, useMathText=None, useLocale=None): useMathText = mpl.rcParams['axes.formatter.use_mathtext'] if useMathText is False: try: - ufont = mpl.font_manager.findfont( - mpl.font_manager.FontProperties( + from matplotlib import font_manager + ufont = font_manager.findfont( + font_manager.FontProperties( mpl.rcParams["font.family"] ), fallback_to_default=False,