- 绘制多个x轴
import matplotlib.pyplot as pltfrom mpl_toolkits import axisartistfrom mpl_toolkits.axes_grid1 import host_subplotfrom models.model7 import read_logdataplt.rcParams['font.sans-serif'] = ['SimHei']plt.rcParams['axes.unicode_minus'] = Falseplt.rcParams['font.size'] = 10plt.rcParams['mathtext.fontset'] = 'stix'filename = '../data/final.xlsx'df = read_logdata(filename)fig = plt.figure(figsize=(5, 8))host = host_subplot(111, axes_class=axisartist.Axes, figure=fig)host.axis['top'].set_visible(True)ax1 = host.twiny()ax2 = host.twiny()ax3 = host.twiny()ax4 = host.twiny()ax5 = host.twiny()ax6 = host.twiny()ax7 = host.twiny()ax8 = host.twiny()axes = [ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8]colors = ['red', 'black', 'green', 'blue', 'darkblue', 'purple', 'orange', 'lightblue']xlabels = ["属性1","属性2","属性3","属性4","属性5","属性6","属性7","属性8"]for i, ax in enumerate(axes):ax.axis["top"] = ax.new_fixed_axis(loc="top", offset=(0, 25 * i))ax.plot(df.iloc[:, 1 + i], df.iloc[:, 0], lw=0.8)xmin = df.iloc[:, 1 + i].min()xmax =