squarify在matplotlibpyplot上工作,所以您只需要将de font size改为pyplot。在
我经常在我的绘图代码上做以下事情。在
SMALL_SIZE = 13
MEDIUM_SIZE = 18
BIGGER_SIZE = 23
plt.rc('font', size=MEDIUM_SIZE) # controls default text sizes
plt.rc('axes', titlesize=BIGGER_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=BIGGER_SIZE) # fontsize of the x and y labels
plt.rc('xtick', labelsize=MEDIUM_SIZE) # fontsize of the tick labels
plt.rc('ytick', labelsize=MEDIUM_SIZE) # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
#Fonts demo (kwargs)
#Set font properties using kwargs.
#See Fonts demo (object-oriented style) to achieve the same effect using setters.
squarify.plot(sizes=volume, label=labels,text_kwargs={'fontsize':10, 'fontname':"Times New Roman Bold",'weight':'bold'},color=color_list, alpha=0.9)
#Fonts demo(kwargs)
# https://matplotlib.org/3.1.0/gallery/text_labels_and_annotations/fonts_demo_kw.html
squarify
在matplotlib
pyplot
上工作,所以您只需要将de font size改为pyplot
。在我经常在我的绘图代码上做以下事情。在
这样您就可以更改绘图的任何字体,包括
squarify
treemap
绘图。在更新: 现在可以通过text_kwargs参数更改字体大小(squarify==0.3.0或更高):
相关问题 更多 >
编程相关推荐