【3.5】matplotlib-font

import matplotlib matplotlib.rc(‘xtick’, labelsize=20) matplotlib.rc(‘ytick’, labelsize=20)

其他

import matplotlib.pyplot as plt

SMALL_SIZE = 8
MEDIUM_SIZE = 10
BIGGER_SIZE = 12

plt.rc('font', size=SMALL_SIZE)          # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE)     # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_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

案例:

title_font = {'fontname':'Arial', 'size':'10', 'color':'black', 'weight':'normal',
              'verticalalignment':'bottom'}
ax1.set_title('Histogram of Mutated Bases Frequency',**title_font)
ax2.set_title('Barplot of Base Mutated Frequency',**title_font)

ax3.set_ylabel('Frequency (%)',size=10)

ax5.set_xlabel('# Mutated Bases',size=10)

参考资料:

https://stackoverflow.com/questions/3899980/how-to-change-the-font-size-on-a-matplotlib-plot

个人公众号,比较懒,很少更新,可以在上面提问题:

更多精彩,请移步公众号阅读:

Sam avatar
About Sam
专注生物信息 专注转化医学