Reputation: 27
I need to convert a grid of values into a density plot to make a picture that shows the structure of the silicon surface that was scanned. The file of values is called stm.txt and can be found here: http://www-personal.umich.edu/~mejn/cp/programs.html
I really can't figure this one out so I'm in some real need of help.
Upvotes: 0
Views: 793
Reputation: 1172
You can use numpy's loadtxt
(https://docs.scipy.org/doc/numpy-1.10.4/reference/generated/numpy.loadtxt.html) to load your data, and then imshow
(https://matplotlib.org/api/_as_gen/matplotlib.pyplot.imshow.html).
import numpy as np
import matplotlib.pyplot as plt
grid = np.loadtxt("stm.txt")
plt.imshow(grid)
plt.show()
Upvotes: 1