import
matplotlib.pyplot as plt
import
numpy as np
plt.style.use(
'seaborn'
)
fig
=
plt.figure()
axes
=
fig.subplots(nrows
=
2
, ncols
=
2
)
axes[
0
,
0
].bar([
'Telugu'
,
'Hindi'
,
'English'
,
'Maths'
,
'Science'
,
'Social'
],
[
50
,
27
,
42
,
34
,
45
,
48
],
color
=
'g'
, label
=
"Students passed in 2017"
)
axes[
0
,
0
].set_yticks(np.arange(
0
,
51
,
5
))
axes[
0
,
1
].bar([
'Telugu'
,
'Hindi'
,
'English'
,
'Maths'
,
'Science'
,
'Social'
],
[
50
,
27
,
42
,
34
,
45
,
48
],
color
=
'y'
, label
=
"Students passed in 2018"
)
axes[
0
,
1
].set_yticks(np.arange(
0
,
51
,
5
))
axes[
1
,
0
].bar([
'Telugu'
,
'Hindi'
,
'English'
,
'Maths'
,
'Science'
,
'Social'
],
[
40
,
27
,
22
,
44
,
35
,
38
],
color
=
'r'
, label
=
"Students passed in 2019"
)
axes[
1
,
0
].set_yticks(np.arange(
0
,
51
,
5
))
axes[
1
,
0
].set_xlabel(
'Subjects'
, fontsize
=
25
)
for
tick
in
axes[
1
,
0
].get_xticklabels():
tick.set_rotation(
45
)
axes[
1
,
0
].set_ylabel(
" Number of Students passed in 2017-2020"
, fontsize
=
20
)
axes[
1
,
1
].bar([
'Telugu'
,
'Hindi'
,
'English'
,
'Maths'
,
'Science'
,
'Social'
],
[
40
,
27
,
32
,
44
,
45
,
48
],
color
=
'b'
, label
=
"Students passed in 2020"
)
axes[
1
,
1
].set_xlabel(
'Subjects'
, fontsize
=
20
)
axes[
1
,
1
].set_yticks(np.arange(
0
,
51
,
5
))
lines
=
[]
labels
=
[]
for
ax
in
fig.axes:
Line, Label
=
ax.get_legend_handles_labels()
lines.extend(Line)
labels.extend(Label)
plt.xticks(rotation
=
45
)
fig.legend(lines, labels, loc
=
'upper right'
)
plt.show()