BaşlayınÜcretsiz başlayın

Generate subplots

You can draw multiple images in one figure to explore data quickly. Use plt.subplots() to generate an array of subplots.

fig, axes = plt.subplots(nrows=2, ncols=2)

To draw an image on a subplot, call the plotting method directly from the subplot object rather than through PyPlot: axes[0,0].imshow(im) rather than plt.imshow(im).

For this exercise, draw im1 and im2 on separate subplots within the same figure.

Bu egzersiz, kursun bir parçasıdır

Biomedical Image Analysis in Python

Kursa Göz Atın

Egzersiz talimatları

  • Create a subplots grid where nrows=2 and ncols=1.
  • Draw im1 and im2 on the first and second subplots respectively. Use a "gray" colormap for each.
  • For each subplot, turn off the axis ticks and labels.
  • Render the figure.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Import PyPlot
import ____ as ____

# Initialize figure and axes grid
fig, axes = ____

# Draw an image on each subplot
axes[0].imshow(____)
____

# Remove ticks/labels and render
axes[0].axis(____)
____
plt.show()
Kodu Düzenle ve Çalıştır