Horje
multiple bar graph in python Code Example
multiple bar graph in python
import numpy as np
import matplotlib.pyplot as plt

X = ['Group A','Group B','Group C','Group D']
Ygirls = [10,20,20,40]
Zboys = [20,30,25,30]

X_axis = np.arange(len(X))

plt.bar(X_axis - 0.2, Ygirls, 0.4, label = 'Girls')
plt.bar(X_axis + 0.2, Zboys, 0.4, label = 'Boys')

plt.xticks(X_axis, X)
plt.xlabel("Groups")
plt.ylabel("Number of Students")
plt.title("Number of Students in each group")
plt.legend()
plt.show()




Python

Related
hover show all Y values in Bokeh Code Example hover show all Y values in Bokeh Code Example
python get substring between strings Code Example python get substring between strings Code Example
python easter egg Code Example python easter egg Code Example
cube python Code Example cube python Code Example
python pair two lists into a dictionary Code Example python pair two lists into a dictionary Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7