0
Я боролся с этим какое-то время и надеюсь, что это простой надзор, как правило, это так.Проложенный текст не согласовывается
Я просто хочу выровнять две строки текста в столбцы. Я пытаюсь это с помощью метода .format string.
import matplotlib.pyplot as plt
bank_percentage=[.33,.25,.08,.15,.07,.08,.11,.3]
percent_text1 = "B0:{:>10.2%} B1:{:>10.2%} B2:{:>10.2%} B3:{:>10.2%}".format(
bank_percentage[0],bank_percentage[1],bank_percentage[2],bank_percentage[3])
percent_text2 = "B4:{:>10.2%} B5:{:>10.2%} B6:{:>10.2%} B7:{:>10.2%}".format(
bank_percentage[4],bank_percentage[5],bank_percentage[6],bank_percentage[7])
fig5= plt.figure(5)
ax = fig5.add_subplot(111)
plt.plot([1,2,3],[1,2,3])
plt.xlabel('Time (ms)')
plt.ylabel('Number of active banks')
plt.title('Active Banks')
ax.text(0.02,0.01, percent_text2, transform=ax.transAxes, fontsize=12, va='bottom', ha='left',
backgroundcolor='black', color='white',weight='bold')
ax.text(0.02,.05, percent_text1, transform=ax.transAxes, fontsize=12, va='bottom', ha='left',
backgroundcolor='black', color='white',weight='bold')
Построение этого показа показывает, что каждый элемент выходит из строя.