多个坐标轴可视化主要代码
在机器学习算法的使用中,我们需要使用多个坐标轴对一些过程数据/预测结果等进行可视化以便于进一步的分析,它的主要python代码如下:
from matplotlib.font_manager import FontProperties # be used to set the fonts
import matplotlib.pyplot as plt
font = FontProperties(fname=r'c:\windows\fonts\simsun.ttc', size=14)
fig, axs = plt.subplots(nrows='number_of_rows', ncols='number_of_cols', sharex='False', sharey='False', figsize=(width, height))
axs[m][n].plot(x, y) # m<number_of_rows,n<number_of_cols x,y:a list
title = axs[m][n].set_title(u'',FontProperties=font)
ylabel = axs[m][n].set_ylabel(u'',FontProperties=font)
xlabel = axs[m][n].set_xlabel(u'',FontProperties=font)
plt.setp(title/xlabel/ylabel, size='', weight='', color='')
plt.show() # show the figure