bar graphs in python code example
Example 1: matplotlib bar chart
import matplotlib.pyplot as plt
names = ["Brad", "Bill", "Bob"]
ages = [9, 5, 10]
plt.bar(names, ages)
plt.show()
Example 2: bar chart in python
import matplotlib.pyplot as plt; plt.rcdefaults()import numpy as npimport matplotlib.pyplot as pltobjects = ('Python', 'C++', 'Java', 'Perl', 'Scala', 'Lisp')y_pos = np.arange(len(objects))performance = [10,8,6,4,2,1]plt.bar(y_pos, performance, align='center', alpha=0.5)plt.xticks(y_pos, objects)plt.ylabel('Usage')plt.title('Programming language usage')plt.show()