То, когда делает блок комментария с информацией о схеме для модели, обновляется направляющими?

Я думаю, что вы можете сначала установить основные галочки y вручную, а затем изменить каждую метку

dfWIM = pd.DataFrame({'AXLES': np.random.randint(3, 10, 1000)})
total = len(dfWIM)*1.
plt.figure(figsize=(12,8))
ax = sns.countplot(x="AXLES", data=dfWIM, order=[3,4,5,6,7,8,9,10,11,12])
plt.title('Distribution of Truck Configurations')
plt.xlabel('Number of Axles')
plt.ylabel('Frequency [%]')

for p in ax.patches:
        ax.annotate('{:.1f}%'.format(100*p.get_height()/total), (p.get_x()+0.1, p.get_height()+5))

#put 11 ticks (therefore 10 steps), from 0 to the total number of rows in the dataframe
ax.yaxis.set_ticks(np.linspace(0, total, 11))

#adjust the ticklabel to the desired format, without changing the position of the ticks. 
_ = ax.set_yticklabels(map('{:.1f}%'.format, 100*ax.yaxis.get_majorticklocs()/total))

19
задан Readonly 26 January 2009 в 22:13
поделиться

2 ответа

Походит на вывод плагин annotate_models. Просто установите его и работайте annotate в Вашем корне направляющих, и информация о схеме обновит автоматически. Идеально, выполните его после каждой миграции.

25
ответ дан 30 November 2019 в 04:08
поделиться

You could also use the annotate-models gem. It's a bit less intrusive as there's no plugin needed.

Usage:

% sudo gem install annotate-models
% annotate
Annotated Product, User, Role

You can find more about it on the gem's homepage.

5
ответ дан 30 November 2019 в 04:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: