Matplotlib chart does not display in PyCharm
plot show with some value, helped in providing the window where I was able to see the image. By default the interactive mode was false. I neeed to turn on the interactive mode.
plt.interactive(True)
Add the plt.show command after plotting the graph.
plt.show(10)
The %
notation is for magic functions. The particular magic function and argument you reference, %matplotlib inline
, is meant for an IPython notebook session. You will get a syntax error using magic functions in a normal python session.
The %matplotlib
magic function is meant to specify a backend for matplotlib and the argument inline
will produce an error if you are not in an IPython notebook session.
To show your plot you should use plt.show
for an interactive window or plt.savefig
to save it to file. For example,
plt.show()
or
plt.savefig( 'myfig.png' )
I got my plot to show by selecting Edit Configurations... and under Execution, check the box Run with Python console. I just used plt.tight_layout(). I was not in a Notebook.
if using an IDE such as Pycharm, instead of using '%matplotlib inline'. Try using: (1) 'import matplotlib.pyplot as plt' (2) plt.imshow(argurment(s))