def test_suptitle_fontproperties(): from matplotlib.font_manager import FontProperties fig, ax = plt.subplots() fps = FontProperties(size='large', weight='bold') txt = fig.suptitle('fontprops title', fontproperties=fps) assert txt.get_fontsize() == fps.get_size_in_points() assert txt.get_weight() == fps.get_weight()
def test_suptitle_fontproperties(): from matplotlib.font_manager import FontProperties fig = plt.figure() ax = fig.add_subplot(1, 1, 1) fps = FontProperties(size='large', weight='bold') txt = fig.suptitle('fontprops title', fontproperties=fps) assert_equal(txt.get_fontsize(), fps.get_size_in_points()) assert_equal(txt.get_weight(), fps.get_weight())
def findFont(self, props): from matplotlib.font_manager import FontProperties, findfont # search for the best match font = FontProperties(fname=findfont(FontProperties(**props))) props = { 'family': font.get_name(), 'weight': font.get_weight(), 'style': font.get_style(), } return props
def findFont(self, props): from matplotlib.font_manager import FontProperties, findfont # search for the best match font = FontProperties( fname=findfont( FontProperties(**props) ) ) props = { 'family' : font.get_name(), 'weight' : font.get_weight(), 'style' : font.get_style(), } return props