Bird
0
0

Which of the following is the correct syntax to display an image stored in variable img using matplotlib?

easy📝 Syntax Q3 of 15
Matplotlib - Image Display
Which of the following is the correct syntax to display an image stored in variable img using matplotlib?
Aplt.show(img)
Bplt.imshow(img)
Cplt.image(img)
Dplt.plot(img)
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct function to display images

    plt.imshow() is the correct function to display image arrays.
  2. Step 2: Verify other options

    plt.image() and plt.show(img) are invalid; plt.plot() is for line plots.
  3. Final Answer:

    plt.imshow(img) -> Option B
  4. Quick Check:

    Image display syntax = plt.imshow() [OK]
Quick Trick: Use plt.imshow() with image variable to display [OK]
Common Mistakes:
  • Using plt.show(img) incorrectly
  • Confusing plt.plot() with imshow

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes