GarrettDaniel commented on issue #16449:
URL: https://github.com/apache/mxnet/issues/16449#issuecomment-1553748541

   It seems that this issue has been resolved in a notebook environment.  The 
tutorial now includes `import matplotlib.pyplot as plt` to solve the issue with 
`plt` not being defined.  Additionally, the 3rd code cell, when run in its 
entirety, functions as expected, displaying the images to the notebook, while 
still saving the variables from previous cells.
   
![image](https://github.com/apache/mxnet/assets/36463300/252688eb-c196-4a12-af7d-9576f30e4870)
   
![image](https://github.com/apache/mxnet/assets/36463300/a5bd8296-c77c-41df-962f-597af10aacb2)
   
   From my understanding, this tutorial was intended to be run in a *notebook 
environment* (i.e. Jupyter notebook), not directly from the terminal.  Notebook 
environments like Jupyter and Jupyterlab work well for rendering images, 
markdown, LaTeX, etc., and were likely intended for this tutorial, given that 
it was written in markdown.
   
   It is important to note that there is still the `DeprecationWarning` (see 
first image above), suggesting that `display.set_matplotlib_formats` is 
deprecated and that `matplotlib_inline.backend_inline.set_matplotlib_formats()` 
should be used instead.  Adding the following code block to the top of the 3rd 
cell and removing the line referenced in the main issue will resolve the 
warning (see accepted answer here for more details 
(https://stackoverflow.com/questions/36622237/jupyter-notebook-inline-plots-as-svg):
   
   `%matplotlib inline`
   `import matplotlib_inline`
   `matplotlib_inline.backend_inline.set_matplotlib_formats('svg')`
   
   
![image](https://github.com/apache/mxnet/assets/36463300/68d05c33-3d48-40cc-9277-8c685843f054)
   
   I'd be happy to make the above changes to remove the warning if that would 
be helpful. 
   
   *Note: this fix requires a notebook environment since it uses the 
`%matplotlib inline` built-in magic command for Jupyter.  This will not work in 
a terminal environment. If you would like to have this work in a terminal 
environment, the suggestion from @TEChopra1000 to remove the line 
`display.set_matplotlib_formats('svg')` still solves the issue in that context. 
 Hope this helps!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org
For additional commands, e-mail: issues-h...@mxnet.apache.org

Reply via email to