0

I am unable to display the .png file created by pyplot. I created the file in Microsoft Azure Jupyter Notebook. os.listdir() returns xx.png, so I know that the file was created. Yet, display xx.png returns invalid syntax. I have read about ten related posts on stackoverflow and tried numeros variations of the command, but nothing works. Here is the code I used to create the .png file. The command plt.show() shows the chart. I can open the .png file from the windows browser. When I run the program on my local computer it works fine.

My objective is to create and frequently update about 20 charts that I can call up and view on demand.

from IPython.display import display
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
y = [2,4,6,8,10,12,14,16,18,20]
x = np.arange(10)
fig = plt.figure()
ax = plt.subplot(111)
ax.plot(x, y, label='$y = numbers')
plt.title('Legend inside')
ax.legend()
fig.savefig('xx.png')
  • 1
    Please take a look at the solution in https://stackoverflow.com/questions/11854847/display-an-image-from-a-file-in-an-ipython-notebook – manojps May 31 '17 at 00:53
  • I have read that post. my file is xx.png – Thomas Culbertson May 31 '17 at 13:28
  • I have read that post. my file is xx.png. It suggested the command display(file="xx.png") which does nothing. I also tryed the command Image('xx.png'). This returns an miniature icon. – Thomas Culbertson May 31 '17 at 13:39
  • I have done the difficult part. I have a bunch of beautiful charts saved as .png files. Now I am hung up on the simplest thing which is to simply display them. – Thomas Culbertson May 31 '17 at 13:57
  • OK I found the problem. I have been working on the Microsoft Azure Machine Learning Studio Platform for about two months. I am very pleased with it. However, in this case there seems to be a problem. When I moved the problem code to my local machine it works just fine. Is there some way that I can use this post to alert others who may experience this problem? – Thomas Culbertson May 31 '17 at 14:15
  • I edited the question per instructions and nothing happened. Can this person just mark my question as a duplicate and just forget it? – Thomas Culbertson Jun 02 '17 at 11:36

0 Answers0