Python Matplotlib Bars

Creating Bars

With Pyplot, you can use the bar() function to draw bar graphs:

Example

Draw 4 bars:

import matplotlib.pyplot as plt
import numpy as np

x = np.array(["A", "B", "C", "D"])
y = np.array([3, 8, 1, 10])

plt.bar(x,y)
plt.show()

 

The bar() function takes arguments that describes the layout of the bars.

The categories and their values represented by the first and second argument as arrays. Continue reading Python Matplotlib Bars