change font size of subplot text

i have a subplot with text labels next to plotted data...i use set(text,'FontSize',8) intending to change default 10 size...text is a handle/struct with such a property and i don't get any errors but there's no effect at all:
for k=1:8:(length(datalabel))
text(l_i(q)+5,var_i(q)-1,datalabel(k:k+7))
set(text,'FontSize',8)
q=q+1;
end

댓글 수: 2

Walter Roberson
Walter Roberson 2016년 5월 11일
Please do not use text as the name of a variable: it is the name of the routine to draw text on a graph.
ethan1987
ethan1987 2016년 5월 11일
Ok Walter...any ideas ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Binbin Qi
Binbin Qi 2016년 5월 11일

0 개 추천

I use the following code, it can work
clear;clc;close all
subplot(335);
fplot(@sin,[-1,1]);
tx = text(.5,.5,'y = sin(x)');
tx.FontSize = 20;

댓글 수: 2

ethan1987
ethan1987 2016년 5월 11일
I don't know what's happening! it won't work for me!...it's works totally indifferent of the setting...i mean i get the text but it doesn't change size! i'm using matlab R2011a..is it ok?
Binbin Qi
Binbin Qi 2016년 5월 11일
I am using matlab R2016a. I think because you use a text as a parameter. The text was interpreted as a command and make a new text. set command works on that new text not on original text.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Labels and Annotations에 대해 자세히 알아보기

질문:

2016년 5월 11일

댓글:

2016년 5월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by