2024-04-19 05:16:09 发布
网友
我需要把一个数值网格转换成一个密度图来绘制一张显示被扫描的硅表面结构的图片。值文件被称为短信.txt可以在这里找到: http://www-personal.umich.edu/~mejn/cp/programs.html
我真的搞不懂这个,所以我真的需要帮助。在
您可以使用numpy的loadtxt(https://docs.scipy.org/doc/numpy-1.10.4/reference/generated/numpy.loadtxt.html)加载数据,然后imshow(https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html)。在
loadtxt
imshow
import numpy as np import matplotlib.pyplot as plt grid = np.loadtxt("stm.txt") plt.imshow(grid) plt.show()
您可以使用numpy的
loadtxt
(https://docs.scipy.org/doc/numpy-1.10.4/reference/generated/numpy.loadtxt.html)加载数据,然后imshow
(https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html)。在相关问题 更多 >
编程相关推荐