[英]2D slope display Python
The question is the following: I have to create a matrix that has values corresponding to the slope inclination.问题如下:我必须创建一个矩阵,其值对应于斜率。 angles between 34 degrees and 28 degrees.
角度介于 34 度和 28 度之间。 I would need to create the matrix and display it in a plot.
我需要创建矩阵并将其显示在 plot 中。
Not sure how to create your matrix.不确定如何创建矩阵。 Usually you have to compute it or load the data from somewhere, but plotting would look like this:
通常你必须计算它或从某个地方加载数据,但绘图看起来像这样:
import matplotlib.pyplot as plt
N = 11
# increase if you like your matrix to be larger, i.e. you like to have a finer mesh
x = np.linspace(0,1,N)
xx, yy = np.meshgrid(x,x)
your_matrix = 34*xx*yy
plt.matshow(your_matrix)
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.