Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Resize text added to image.

Subject: Resize text added to image.

From: Bryan

Date: 1 Aug, 2013 19:58:02

Message: 1 of 2

I'm trying to plot some scatter data on top of an image, and then label each scatter point with a number corresponding to that sites entry in some .mat files. This seems to work fine, except for one issue - I cannot change the size of the text, and the default is too big! The code is fairly basic:

%=======================================================
% ImA is the image I am plotting data onto
% ImB is a series of x/y coordinates
% ImC the data labels (cell array of strings)
% i, because this is in a loop

dX = 10;
dY = -10;

figure(i);
imshow (ImA, [400 7000]);
hold on;
scatter (ImB(:,1), ImB(:,2), 25, 'r'); %plot a 25-unit red circle at each point
text((ImB(:,1)+dX, (ImB(:,2)+dY, ImC, 'FontSize', 4, 'Color', [1,0,0]);

% this will be followed by code that further modifies and saves the figures
%=======================================================

Everything works aside from the font size command (no matter what size I choose). Even the color option works, despite being in the same line!

Any help is appreciated. This is in matlab R2011a (I should probably upgrade that!), in Ubuntu 13.04.

Thanx

Bryan

Subject: Resize text added to image.

From: Kevin Hellemans

Date: 2 Aug, 2013 07:33:17

Message: 2 of 2

I don't know about any bugs in the text command, but I do know it has a LaTeX compiler available. So perhaps you can try to wrap it in latex code:

figure;
% Regular Size
text(0.5,0.5,'test')
% Smaller size
text(0.5,0.4,'_{test}')

It is not really elegant, but I hope it helps.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us