From: Mayi DA on
Dear all
Here is an example code:
plot(rand(10,2));
hl=legend({'data1','data2'});
set(hl,'FontAngle','normal'); % set legend font to normal
set(gca,'FontAngle','italic') % set gca axes font to italic

then, you will see that Legend font is 'Italic', not 'normal'.
My matlab version is2010A, so this phenomena is normal or bug?

mayi
2010-7-14
From: Cris Luengo on
"Mayi DA" <spam(a)gmail.com> wrote in message <i1k5qn$e8h$1(a)fred.mathworks.com>...
> Dear all
> Here is an example code:
> plot(rand(10,2));
> hl=legend({'data1','data2'});
> set(hl,'FontAngle','normal'); % set legend font to normal
> set(gca,'FontAngle','italic') % set gca axes font to italic
>
> then, you will see that Legend font is 'Italic', not 'normal'.
> My matlab version is2010A, so this phenomena is normal or bug?
>
> mayi
> 2010-7-14

The legend is a child of GCA, setting the font for an axis changes the font for its children also. Try this:

plot(rand(10,2));
hl=legend({'data1','data2'});
set(gca,'FontAngle','italic') % set gca axes font to italic
set(hl,'FontAngle','normal'); % set legend font to normal

Cheers,
Cris.
From: us on
"Mayi DA" <spam(a)gmail.com> wrote in message <i1k5qn$e8h$1(a)fred.mathworks.com>...
> Dear all
> Here is an example code:
> plot(rand(10,2));
> hl=legend({'data1','data2'});
> set(hl,'FontAngle','normal'); % set legend font to normal
> set(gca,'FontAngle','italic') % set gca axes font to italic
>
> then, you will see that Legend font is 'Italic', not 'normal'.
> My matlab version is2010A, so this phenomena is normal or bug?
>
> mayi
> 2010-7-14

yes...
look at this recent thread for another apparent anomaly...

http://www.mathworks.com/matlabcentral/newsreader/view_thread/286701

one of the solutions

plot(rand(10,2));
hl=legend({'data1','data2'});
% switch commands...
set(gca,'FontAngle','italic');
set(hl,'FontAngle','normal');

us
From: Mayi DA on
Dear,
As you have mentioned before, legend is a child of GCA, and set gca can affect legend, but the following code seems not support your statement.

plot(rand(10,2));
hl=legend({'data1','data2'});
set(hl,'Fontsize',20);
set(gca,'Fontsize',10) ;

you will see that GCA fontsize is 10 and Legend fontsize is 20 (not 10)

mayi
2010-07-14

"us " <us(a)neurol.unizh.ch> wrote in message <i1k6ok$elh$1(a)fred.mathworks.com>...
> "Mayi DA" <spam(a)gmail.com> wrote in message <i1k5qn$e8h$1(a)fred.mathworks.com>...
> > Dear all
> > Here is an example code:
> > plot(rand(10,2));
> > hl=legend({'data1','data2'});
> > set(hl,'FontAngle','normal'); % set legend font to normal
> > set(gca,'FontAngle','italic') % set gca axes font to italic
> >
> > then, you will see that Legend font is 'Italic', not 'normal'.
> > My matlab version is2010A, so this phenomena is normal or bug?
> >
> > mayi
> > 2010-7-14
>
> yes...
> look at this recent thread for another apparent anomaly...
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/286701
>
> one of the solutions
>
> plot(rand(10,2));
> hl=legend({'data1','data2'});
> % switch commands...
> set(gca,'FontAngle','italic');
> set(hl,'FontAngle','normal');
>
> us
From: us on
"Mayi DA" <spam(a)gmail.com> wrote in message <i1kcnv$cgv$1(a)fred.mathworks.com>...
> Dear,
> As you have mentioned before, legend is a child of GCA, and set gca can affect legend, but the following code seems not support your statement.
>
> plot(rand(10,2));
> hl=legend({'data1','data2'});
> set(hl,'Fontsize',20);
> set(gca,'Fontsize',10) ;
>
> you will see that GCA fontsize is 10 and Legend fontsize is 20 (not 10)
>
> mayi
> 2010-07-14

well...
yes, of course...
did you take the time to actually LOOK and STUDY was was shown to you (incl the web-pointer) - or are you simply and mindlessly repeat the well-known issue...

us