Search code examples
imagematlabplottitleimshow

Showing image title with imshow method in MATLAB


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

Solution

  • 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