Шаг 1. Установи matplotlib
pip install matplotlib
Шаг 2. Импортируй pyplot
import matplotlib.pyplot as plt
Шаг 3. Подготовь данные
categories = ['A', 'B', 'C', 'D', 'E']
values = [10, 15, 7, 12, 20]
Шаг 4. Задай цвета для столбцов
colors = ['red', 'blue', 'green', 'orange', 'purple']
Шаг 5. Построй диаграмму
plt.figure(figsize=(6,4))
plt.bar(categories, values, color=colors)
Шаг 6. Добавь подписи и заголовок
plt.xlabel('Categories')
plt.ylabel('Values')
plt.title('Colored Bar Graph')Шаг 7. Покажи график
plt.show()
👉 @PythonPortal
