Pat
Pat

Reputation: 69

Python2: Resize image plotted using Matplotlib

I'm coding using Jupyter Notebook with Python 2 + OpenCV 3, and I need to show my results using images. The images are very small and it's hard to observe the results.

from matplotlib import pyplot as plt
import cv2

thresh = 127
maxValue = 255
file_path = "dados/page1.jpg"
%matplotlib notebook

image = cv2.imread(file_path)
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
plt.title("First image")
plt.imshow(gray_image)

Output image

Image is too small. How can I zoom it?

Upvotes: 1

Views: 2571

Answers (1)

ImportanceOfBeingErnest
ImportanceOfBeingErnest

Reputation: 339230

As usual you can set the figure size using

plt.figure(figsize=(8,12))

The maximal figure size is (50,50), however you need to choose sensible values yourself depending on your screen size.

Upvotes: 1

Related Questions