I am currently using visual studio code to debug a python file. In that python file is a numpy image. When i try to import matplotlib to display the image, it doesn't show:
- plt.imshow(pred_scores)
<matplotlib.image.AxesImage object at 0x7f3d43e691d0>
- plt.show()
None
- pred_scores
array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...
Basically nothing happens. Is it actually possible to show an image here?
There's an extension allows you to view images/plots during python debugging. You simply select the image variable in the editor, and click on the light bulb will appear near it. Basically, it just save the image into a temporary location, and open it on the side.
Disclaimer: I'm the author of the extension.
https://marketplace.visualstudio.com/items?itemName=elazarcoh.simply-view-image-for-python-debugging
You could use VS Code Jupyter Interactive Windows to render your plots.
At the entry script of your solution code base (e.g. main.py), either start a debugging session in Interactive Window (> Jupyter: Debug Current File in Interactive Window) from the command palette, or, as I prefer, add #%% at the first line and click Debug Cell.

You can now interactively render your plots during a VS Code debugging session, regardless of whether it is locally or remotely

There is a discussion about this on GitHub
https://github.com/microsoft/vscode-jupyter/issues/1278
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With