Question : what order determines the contour from matplotlib for the input 2D array?
Designed by . Matplotlib contour documentation says a normal call
x_axis = np.linspace(10,100,n_x) y_axis = np.linspace(10,100,n_y) matplotlib.pyplot.contour(x_axis, y_axis, scalar_field)
Where scalar_field should be a two-dimensional array. For example, a scalar field can be generated using
scalar_field = np.array( [(x*y) for x in x_axis for y in y_axis]) scalar_field = scalar_field.reshape(n_x, n_y)
If a scalar field is given a contour,
plt.contour(x_axis, y_axis,scalar_field) #incorrect
the orientation of the graph is incorrect (rotated). To restore the correct orientation, the scalar field must be transposed:
plt.contour(x_axis, y_axis,scalar_field.transpose()) #correct
So, what is the order in which the contour expects the scalar field to have?
source share