0

I am using colab notebook for generating some numbers using autoencoders. I am able to generate the numbers successfully but it is really small and invisible. I am using matplotlib for data viz.

Here is my plot_image function:

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

Here is my code for visualizing the numbers:

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

I am also using matplotlib inline function as:

%matplotlib inline

Can anyone guide me to visualize my result with a bigger plot? I am attaching the screenshot of my generated result.Thanks in advance guys.

Here is the result of my numbers

3
  • Sometimes my plots are small when I call plt.show() but then I can resize the window and it grows with it. Would that be applicable with %matplotlib inline? Or maybe instead of a 10 X 1 you could make a 5 X 2 or 3 X 3 and omit the last graph? Here is their documentation: matplotlib.org/api/_as_gen/… It tells you all the methods available to you, as well as some examples at the bottom you can look through! Commented Feb 26, 2019 at 18:30
  • i tried as you said but still its same. Let me go through the link that u mentioned. Thanks though Commented Feb 26, 2019 at 18:35
  • possible duplicate of - stackoverflow.com/questions/36367986/… Commented Feb 26, 2019 at 18:35

1 Answer 1

0

You can increase the figure size by use the figure command. See below

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()
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks this works but can you explain little about height*width in inches? what are the ideal combo to use?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.