import matplotlib.pyplot as plt
years = [2014, 2016, 2018, 2020, 2022, 2024]
languages = ["Python", "JavaScript", "TypeScript", "Java", "C#"]
rankings = [
[8, 6, 5, 3, 2, 1], [1, 2, 2, 2, 3, 2],
[10, 9, 8, 5, 5, 3], [2, 3, 3, 4, 4, 4],
[5, 4, 4, 6, 6, 5], ]
colors = ["lime", "magenta", "purple", "orange", "cyan", ]
plt.figure(figsize=(10, 6))
for i, (language, ranking) in enumerate(zip(languages, rankings)):
plt.plot(years, ranking, label=language, color=colors[i], linewidth=2)
plt.gca().invert_yaxis()
plt.xticks(years, fontsize=10)
plt.yticks(range(1, 13), fontsize=10)
plt.title("Programming Language Trends (2014 - 2024)", fontsize=14)
plt.xlabel("Year", fontsize=12)
plt.ylabel("Rank", fontsize=12)
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', fontsize=9)
plt.grid(color='gray', linestyle='--', linewidth=0.5, alpha=0.7)
plt.tight_layout()
plt.show()
0 Comments:
Post a Comment