adriana leontina
adriana leontina

Reputation: 11

Can't plot a chart with matplotlib

I have this code, and it's supposed to plot me a chart with a number, but it won't work. And I don't get any error

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)

Thank you for your answers!

Upvotes: 0

Views: 421

Answers (1)

qmeeus
qmeeus

Reputation: 2422

Your code should not even run:

  • all_values = data_list[0].split(',') should give NameError: data_list undefined
  • plt.show should give NameError: plt undefined
  • plt.show(image_array, cmap='Greys', interpolation='None') should give TypeError: got an unexpected keyword argument 'cmap'

My guess is that your code did not run at all... In PyCharm, you should be able to right click on your script and click on run script or something

Upvotes: 1

Related Questions