def draw_subplot(df, subplot_count, color, graph_num, graph_limit, sub_type):
plt.figure(figsize=(20,15))
for i in range(subplot_count):
plt.subplot(x_size,y_size,i+1)
plt.plot(df[graph_num].index, df[graph_num][x_axis], color = color,
linestyle = 'none', marker = 'o', markersize = 4, alpha = 0.5)
plt.ylabel(x_axis)
plt.ylim(-0.1, 0.5)
plot_title = df[graph_num][sub_type].unique()
plt.title(plot_title[0])
graph_num = graph_num + 1
if graph_num == graph_limit:
break
return graph_num
# %%
image_counts = 7
sub_type = 'PEER_NAME'
x_axis = 'ABNORMAL_USU'
color = 'green'
x_size = 4
y_size = 2
subplot_count = x_size*y_size
graph_limit = 52
graph_num = 0
for i in range(image_counts):
graph_num = draw_subplot(grouped_df, subplot_count, color, graph_num, graph_limit, sub_type)