How can I populate the subplot within the for loop? I want that the ax
starts with ax[0,0]
and continues with ax[0,1]
,ax[0,2]
,ax[0,3]
,ax[1,0]
,ax[1,1]
..., until the loop finnished. I tried e.g. ax[i//3, range(2)]
but did not found the right solution so far.
fig, ax = plt.subplots(3,measurements//3,facecolor='w', sharex=True)
for i in range(0,measurements):
try:
x = self.len.iloc[:,i]
y = self.dfr.iloc[:,i]
inds = ~np.logical_or(np.isnan(x), np.isnan(y))
x = x[inds]
y = y[inds]
xy = np.vstack([x,y])
z = gaussian_kde(xy)(xy)
b, m = polyfit(x, y, 1)
ax[].scatter(x, y, c=z, s=50, cmap='jet', edgecolor='', label=None, picker=True, zorder= 2)
ax[].plot(x, b + m * x, '-')
ax[].set_xlim(0,100)
except KeyError:
pass
plt.show()