I'm having a problem getting the title to set for some loglog plots in Matlab. The title function works fine when plotting the same data using plot(x,y), but fails to display when using loglog(x,y). I thought it might be a bug triggered by the data, but it looks like I was wrong - please see the commenting below.
%title_prob
figure
x=0:1:1000;
y=3*x.^x; %The sum of this vecor is Inf
loglog(x,y)
title('Title','FontSize',16) %This title doesn't set
xlabel('X Label','FontSize',12)
ylabel('Y Label','FontSize',12)
figure
x2=0:1:100;
y2=3*x2.^x2; %The sum of this vector is finite
loglog(x2,y2)
title('Title','FontSize',16) %This title does set
xlabel('X Label','FontSize',12)
ylabel('Y Label','FontSize',12)
%Further investigation - is Inf to blame? Apparently not.
FirstInf=max(find(y<Inf))+1;
figure
loglog(x(1:FirstInf),y(1:FirstInf))
title('Inf value in the y vector','FontSize',16) %Title not set
figure
loglog(x(1:FirstInf-1),y(1:FirstInf-1))
title('NO Inf value in the y vector','FontSize',16) %Title not set
figure
plot(x,y)
title('Works for the plot function','FontSize',16)
Thanks for any suggestions.