image - Manage font type and size of text on Matlab plot -


i have achieved plot 28x28 grayscale image on matlab , insert number @ particular location of figure, how can increase size of font, change color or type (e.g. verdana).

% myimage 28x28 matrix values 0 255 imagesc(myimage); colormap(gray)  %insert text text(1,1,'7'); 

yup. use 'fontname' attribute. if want change size, use 'fontsize', , colour, use 'color' attribute... this:

text(1, 1, '7', 'fontname', 'verdana', 'fontsize', 16, 'color', 'blue'); 

change above attributes whatever want, i've made font size 16, font verdana , colour of text blue. more information text function , attributes can found in official mathworks documentation: http://www.mathworks.com/help/matlab/ref/text-properties.html

here's example of in action:

>> im = rand(7,7); >> imagesc(im); >> text(1, 1, '7', 'fontname', 'verdana', 'fontsize', 16, 'color', 'red'); 

we figure:

enter image description here

you can see switched verdana, , placed blue 7 font size 16 , location (1,1) in image.


Comments