Milan
Milan

Reputation: 492

Matlab: image plot caption overlapping the image

I'm plotting several image subplots into one Matlab figure. (using imshow() and subplot(), respectively subaxis())

Using title() to describe the images consumes too much space in the figure.

Therefore, I would like to write a caption overlapping part of the image (something like legend() for function plots), but I can't find a corresponding function for that.

Is there some common way how to do that?

Thanks in advance!

Upvotes: 0

Views: 1461

Answers (2)

Gordon Bean
Gordon Bean

Reputation: 4602

You can also use the text command to place text anywhere on the image, including OUTSIDE the axes.

plot([1 2 3 4])
xlim([1 4])
ylim([1 4])
text(mean(xlim), max(ylim)+0.05*diff(ylim), 'The title', 'horizontalAlignment', 'center')

You can edit other text properties as you would any other Matlab text object.

Upvotes: 1

Schorsch
Schorsch

Reputation: 7895

Return a handle for the title and modify it:

figure(1)

handle=title('My Title');
set(handle,'Position',[0.5 0.9]);

Upvotes: 0

Related Questions