簡體   English   中英

如何使用plt.subplot增加我的圖的大小

[英]How to increase the size of my plot using plt.subplot

我正在使用colab筆記本使用自動編碼器生成一些數字。 我能夠成功生成數字,但它確實很小且看不見。 我正在使用matplotlib進行數據可視化。

這是我的plot_image函數:

  def plot_image(image, shape=[28,28]):
     plt.imshow(image.reshape(shape), cmap="Greys", interpolation="nearest")
     plt.axis("off")

這是我的數字可視化代碼:

  for iteration in range(n_digits):
     plt.subplot(n_digits, 10, iteration+1)
     plot_image(outputs_val[iteration])

我還將matplotlib內聯函數用作:

%matplotlib inline

誰能指導我以更大的圖表可視化我的結果? 我附上了我生成的結果的屏幕截圖,謝謝大家。

這是我的數字的結果

您可以使用Figure命令來增加圖形大小。 見下文

def plot_image(image, shape=[28,28]):
    fig = plt.figure(figsize=(18, 18)) # set the height and width in inches
    plt.imshow(image.reshape(shape), cmap="Greys", interpolation="nearest")
    plt.axis("off")
    plt.show()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM