I understand that the gradient direction goes from a low to high value. Here is an example:
import numpy as np
import matplotlib.pyplot as plt
import math
I = np.zeros((3,4), dtype=np.float64)
I[:,0:3] = 1
Y,X = np.mgrid[0:3, 0:4]
Iy,Ix = np.gradient(I)
#plotting quiver plot 1
plt.quiver(X,Y, Ix,Iy, color='r')
plt.imshow(I)
As you can see in plot 1 above, the direction is going from the 0 values (low) to the 1 values (high).
When I flip the matrix and follow the same procedure, the direction is reversed (high to low) as shown here:
I2 = np.zeros((3,4), dtype=np.float64)
I2[0:2,:] = 1
print(I2)
Iy2,Ix2 = np.gradient(I2)
plt.imshow(I2)
plt.quiver(X,Y, Ix2,Iy2, color='r')
Shouldn't the arrows be pointing upwards instead of downwards? What am I missing?

