Мой код: прокрутите вниз до ##### Part where the question is related #####
Это часть репозитория: https://github.com/soobinck/rotarod_ML/featureImportance/featureImportance_decisionTreeImportancePlot.py
import os
import string
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from utils.getDirAbsPath import outputAbsPath
inputCSV = './output.csv'
# Plot importance when the number of intervals is 2.
interval = len(string.ascii_lowercase)
df = pd.read_csv(inputCSV, index_col=0)
df01 = df[['0', '1']]
bins = np.array_split(df01, len(df01) / interval)[1]
df01 = pd.DataFrame(bins)
xlabel = '(i)th interval'
ylabel = 'feature importance'
title = 'Feature importance in classifying genotypes (%i iterations)' % interval
outputPath = os.path.join(outputAbsPath(), 'featureImportance', 'accuracies.png')
footnote = footnote = 'Classified with mean step up height as the model\'s input. Classified with mean step up height as the model\'s input. Classified with mean step up height as the model\'s input. Classified with mean step up height as the model\'s input. Classified with mean step up height as the model\'s input. '
# Plotting
fig, ax = plt.subplots(figsize=(15, 11), tight_layout=True)
plt.subplots_adjust(hspace=1.0, wspace=0.02, bottom=0.17)
# Creating axes instance
bp = ax.boxplot(df, patch_artist=True,
notch='True')
# changing color and linewidth of
# whiskers
for whisker in bp['whiskers']:
whisker.set(color='#8B008B',
linestyle=":")
# changing color and linewidth of
# caps
for cap in bp['caps']:
cap.set(color='#8B008B')
# changing color and linewidth of
# medians
for median in bp['medians']:
median.set(color='red')
# changing style of fliers
for flier in bp['fliers']:
flier.set(marker='D',
color='#e7298a',
alpha=0.5)
# x-axis labels
ax.set_xlabel(xlabel)
ax.set_ylabel(ylabel)
# Adding title
plt.title(title)
fig.subplots_adjust(bottom=0.2)
##### Part where the question is related #####
ft = plt.figtext(0, 0, footnote, wrap=True, va='bottom', fontsize=11)
#Have tried:
# ax.annotate(footnote, (0,-0.2), xycoords='figure fraction')
# plt.subplots_adjust(hspace=1.0, wspace=0.02, bottom=0.17)
# fig.subplots_adjust(bottom=0.2)
plt.tight_layout()
##### Part where the question is related #####
fig.savefig(outputPath)
# pickle.dump(fig, open((outputPath + '.fig.pickle'), 'wb'))
# show plot
fig.show()
print('%s saved.' % outputPath)
Я продолжаю закрывать сноску xlabel. Я перепробовал практически все возможные решения, которые смог найти в сети. Может кто-нибудь, пожалуйста, дайте мне знать, как добавить длинные сноски к графику? Формат должен быть как в газете. Слева и справа выровнены по краям графика (не по размеру фигуры). Выровнено по левому краю, но растянуто так, чтобы строки, кроме последней, заполняли всю строку.
Огромное спасибо заранее! :)