我有这段代码,应该为我绘制一个带有数字的图表,但是它不起作用。而且我没有任何错误
import numpy
import matplotlib.pyplot
# %matplotlib inline
all_values = data_list[0].split(',')
image_array = numpy.asfarray(all_values[1:]).reshape((28, 28))
matplotlib.pyplot.imshow(image_array, cmap='Greys', interpolation='None')
plt.show(image_array, cmap='Greys', interpolation='None')
scaled_input = (numpy.asfarray(all_values[1:]) / 255.0 * 0.99) + 0.1
print (scaled_input)
谢谢您的回答!
您的代码甚至不应运行:
all_values = data_list[0].split(',')
应该给NameError: data_list undefined
plt.show
应该给NameError: plt undefined
plt.show(image_array, cmap='Greys', interpolation='None')
应该给TypeError: got an unexpected keyword argument 'cmap'
我的猜测是您的代码根本没有运行...在PyCharm中,您应该能够右键单击脚本,然后单击run script
或其他内容