Skip to content

Instantly share code, notes, and snippets.

@ShawonAshraf
Created November 6, 2020 13:19
Show Gist options
  • Save ShawonAshraf/f43c65415a5933c6ed9bc7be70a8612c to your computer and use it in GitHub Desktop.
Save ShawonAshraf/f43c65415a5933c6ed9bc7be70a8612c to your computer and use it in GitHub Desktop.
For Tahmid Vai's work
ncols = 3
nrows = 4
# create a figure of dimension nrows X ncols
fig, ax = plt.subplots(nrows=nrows, ncols=ncols, figsize=(20, 15))
# keeps track of the indexes of iaq
df_idx_counter = 0
# iterate through the grid and plot one iaq element in each grid box
for row_idx in range(nrows):
for col_idx in range(ncols):
# since manually incrementing, the index can get out of bound
if df_idx_counter > len(iaq) - 1:
break
# query is based on date
date = iaq.iloc[df_idx_counter]
# increment index counter
df_idx_counter += 1
# get the dataframe to plot
df_to_plot = gcdf_cs_1[gcdf_cs_1['aq_date'] == date]
# axis is the box in the grid to plot the dataframe in
axis = ax[row_idx][col_idx]
# plot
df_to_plot.plot(column='zone_id', cmap='summer', ax=axis, legend=True)
axis.set_title('Analysis :'+ str(date))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment