Barplots built with matplotlib in Python 3
# libraries
import numpy
as np
import matplotlib.pyplot
as plt
# create a dataset
objects = ('Python', 'Java', 'Swift', 'JavaScript')
performance = [10, 8, 9, 8]
y_pos = np.arange(len(objects))
# create bars with different colors
plt.
bar(y_pos, performance,
align='center',
alpha=0.7,
color=['red', 'yellow', 'red', 'yellow'])
# create names on the x-axis
plt.xticks(y_pos, objects)
# set title
plt.title('Top 4 programming languages in 2022')
# set title on the left
plt.ylabel("
www.it-guru.kz ")
# show graph
plt.show()
Возврат к списку