MNM
MNM

Reputation: 2743

Matplotlib is working but the images are super small

I have a plot working I think, but when I go to plt.show() it just prints off tiny images. I cant really see what it is. The raw image size is 160X60. How can I make the images larger so I can see what they are? The score is a number and the resultID is a name of the image Thank you for any help

Here is the code that I am using.

n_retrieval = len(result)
fig = plt.figure(figsize=(2*n_retrieval, 4))
fig.suptitle("Image Retrieval (k={})".format(n_retrieval), fontsize=25)

# Plot the Query image
ax = plt.subplot(2, n_retrieval, 0 +1)
q_img = mpimg.imread(queries + "0002_c1s1_000451_03.jpg")
plt.imshow(q_img)
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
for axis in ['top', 'bottom', 'left', 'right']:
    ax.spines[axis].set_linewidth(4)  # increase border thickness
    ax.spines[axis].set_color('black')  # set to black
ax.set_title("query",  fontsize=14)  # set subplot titl

for i, (score, resultID) in enumerate(results):
    result_path = resultID.split('\\')[1]
    image_path = dataset+ result_path
    img = mpimg.imread(image_path)
    ax = plt.subplot(2, n_retrieval, n_retrieval + i + 1)
    plt.imshow(img)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    for axis in ['top', 'bottom', 'left', 'right']:
        ax.spines[axis].set_linewidth(1)  # set border thickness
        ax.spines[axis].set_color('black')  # set to black
    ax.set_title("Rank #%d" % (i+1), fontsize=14)  # set subplot title

plt.show()

Upvotes: 0

Views: 2038

Answers (2)

ASHu2
ASHu2

Reputation: 2047

Use big numbers in figsize.

fig = plt.figure(figsize=(18, 10))

Upvotes: 1

MNM
MNM

Reputation: 2743

Never Mind. For some reason if you double click on the image in Jupiter it will enlarge it. Its so weird.

Upvotes: 0

Related Questions