Мои коды следующие:
Код: Выделить всё
import matplotlib.pyplot as pltimport numpy as np
Код: Выделить всё
data_to_plot = [avg[0]['Cell Perimeter (unit pixel side)'], avg[1]['Cell Perimeter (unit pixel side)'], avg[2]['Cell Perimeter (unit pixel side)']]
Код: Выделить всё
fig = plt.figure()ax = fig.add_axes([0,0,1,1])
Код: Выделить всё
# Create the violinplot
bp = ax.violinplot(data_to_plot)
fig.tight_layout()
plt.xticks([1, 2, 3], ['5.5', '12.5', '25'])
plt.ylabel('Unit pixel side')
plt.xlabel('Glucose concentration (mM)')
plt.title('Cell perimeter axis distribution')
fig.savefig('Cell perimeter distrution.tiff')
plt.savefig('Cell perimeter distribution.jpg')
plt.show()
Предупреждение пользователя: этот рисунок включает Оси несовместимы с плотно_layout, поэтому результаты могут быть неверными.
fig.tight_layout()
Я также пробовал fig.patch.set_facecolor('xkcd:white'), и это не работает.
Большое спасибо за помощь.
Подробнее здесь: https://stackoverflow.com/questions/792 ... layout-but