Код: Выделить всё
[Timestamp('2022-01-01 21:00:00'),
Timestamp('2022-01-02 21:15:00'),
Timestamp('2022-01-03 21:00:00'),
Timestamp('2022-01-04 20:00:00'),
Timestamp('2022-01-05 21:00:00'),
....
]
Итак, моя попытка заключается в следующем:
Код: Выделить всё
labels, counts = np.unique(histogram, return_counts=True)
all_sum = sum(counts)
percentages = [i * 100 / all_sum for i in counts]
bars = plt.bar(labels, counts, align="center", width=13, color="blue", edgecolor="black")
for i, p in enumerate(bars):
width = p.get_width()
height = p.get_height()
x, y = p.get_xy()
print(x, y)
plt.text(x + width / 2, y + height * 1.01, "{0:.2f}".format(percentages[i]) + "%", ha="center", weight="bold")
plt.gca().set_xticks(labels)
plt.grid(False)
plt.tight_layout()
plt.show()
[img]https://i .sstatic.net/ZqhXU.png[/img]
Не знаю, почему эти полосы перекрываются...
Подробнее здесь: https://stackoverflow.com/questions/736 ... -timestamp
Мобильная версия