0

atm I learn Python to do ML. I use Visual Studio 2019 as IDE (not Visual Studio code!). To show image data I installed and imported matplotlib. Here is an excerpt how I call matplotlib

import matplotlib.pyplot as plt

. . .

for image_batch, label_batch in dataset.take(1):
    print(image_batch.shape)
    print(label_batch.numpy())
    plt.imshow(image_batch[0].numpy().astype("uint8"))
    plt.title(class_names[label_batch[0]])
    plt.axis("off")

My example code runs without an error. But the program only prints text in the console. There is no windows showing my picture. I tried to find a solution how to use matploblib in Visual Studio, but I only found information about how to achieve it in Visual Studio Code. What must I do or which extension must install to see the plotted images?

Best regards

Gilad Pellaeon
  • 111
  • 1
  • 1
  • 11
  • Try `plt.show()` after `plt.axis('off')`. – Trenton McKinney Sep 28 '21 at 16:06
  • [visual studio 2019 how to show plots site: stackoverflow.com](https://www.google.com/search?q=visual+studio+2019+how+to+show+plots+site%3A+stackoverflow.com&sxsrf=AOaemvILouyi4fu4B9lKiObngklHsSK3Ng%3A1632845201796&ei=kT1TYdyDMNf_-gTO26y4Bw&oq=visual+studio+2019+how+to+show+plots+site%3A+stackoverflow.com&gs_lcp=Cgdnd3Mtd2l6EAM6BwgjELADECc6BwgAEEcQsAM6CAghEBYQHRAeOgUIIRCgAToHCCEQChCgAToFCCEQqwI6BAghEApKBAhBGABQ4T9Y139gg4IBaANwAngAgAHYAYgBxxKSAQYyNC4xLjGYAQCgAQHIAQnAAQE&sclient=gws-wiz&ved=0ahUKEwickOexhqLzAhXXv54KHc4tC3cQ4dUDCA4&uact=5) – Trenton McKinney Sep 28 '21 at 16:08
  • This does not really help, because you will find infomration how to do it in Visual Studio Code . But as I wrote: I use VS 2019, not VS Code. Therefor, I asked my question. – Gilad Pellaeon Sep 29 '21 at 06:13

0 Answers0