11

How can I show image titles in MATLAB figures? I have the following code below:

I=imread('./../images/pap.png');
subplot(1,2,1);
imshow(I); % here I want to show labels
rayryeng
  • 102,964
  • 22
  • 184
  • 193
it's me
  • 188
  • 1
  • 1
  • 10

1 Answers1

22

Use the title command. It works pretty much like plot. imshow spawns a new figure so you can apply commands that you would for any figure in here. By using title, you will give your image a title and it appears at the top of your image.

As such:

I=imread('./../images/pap.png');
subplot(1,2,1);
imshow(I);
title('Labels'); % Place title here
rayryeng
  • 102,964
  • 22
  • 184
  • 193