title: FontSize for the image's legend in Matlab
body: <p>I have the following code:</p>
  
  <pre><code>X = 0:pi/100:0.25*pi;
  Y1 = sin(X);
  Y2 = cos(X);
  Y3 = tan(X);
  fh = figure('toolbar','none','menubar','none','Units','characters');
  Pan1 = uipanel(fh,'Units','normalized','Position',[0 0 0.5 1],'title',...
    'Panel1');
  Pan2 = uipanel(fh,'Units','normalized','Position',[0.5 0 0.5 1],'title',...
    'Panel2');
  haxes = axes('Parent',Pan2,'Units', 'normalized','Position',...
  [0.125 0.1 0.75 0.75]);
  hplot = plot(haxes,X,Y1,X,Y2,X,Y3);
  xlabel(haxes,'Time (second)');
  ylabel(haxes,'Amplitude (meter)');
  title(haxes,'Trigonometric functions');
  Ley = {'Sine function','Cosine function','Tangent function'}; %# legend's strings values
  legend(haxes,Ley,'Location','SouthOutside');
  [FileName,PathName,FilterIndex] = uiputfile('*.bmp;*.png;*.jpg;*.tif','Save as');
  ftmp = figure('Menu','none','Toolbar','none','Units','normalized',...
    'Position',[-1000 -1000 1 1]);
  set(gcf,'PaperPositionMode','auto');
  set(gcf,'InvertHardcopy','off');
  new_axes = copyobj(haxes, ftmp);
  legend(new_axes,Ley,'Location','SouthOutside','FontSize',8);
  set(new_axes,'Units','normalized','Position',[0.1 0.1 0.8 0.8]);
  fmtgraf = {'-dbmp','-dpng','-djpeg','-dtiff'};
  fmt = fmtgraf{FilterIndex};
  print(ftmp,fmt,FileName,'-r0');
  delete(ftmp);
  delete(fh);
  </code></pre>
  
  <p>As seen in the code, the command line </p>
  
  <p>legend(new_axes,Ley,'Location','SouthOutside','FontSize',8);</p>
  
  <p>is run before the command line</p>
  
  <pre><code> set(new_axes,'Units','normalized','Position',[0.1 0.1 0.8 0.8]);
  </code></pre>
  
  <p>Because of it, the image appears cutted by its low part as seen below (independently of the existence or no existence of the property/value 'FontSize')
  <img src="https://i.stack.imgur.com/pdUId.png" alt=""></p>
  
  <p>If the command line </p>
  
  <pre><code> legend(new_axes,Ley,'Location','SouthOutside','FontSize',8);
  </code></pre>
  
  <p>is run after the command line</p>
  
  <pre><code> set(new_axes,'Units','normalized','Position',[0.1 0.1 0.8 0.8]);
  </code></pre>
  
  <p>now the image is cutted by its low part but in this case it is not seen neither the xlabel text nor the legend box (as seen below)
  <img src="https://i.stack.imgur.com/DmFJi.png" alt=""></p>
  
  <p>If <code>'FontSize',8</code> is suppressed, all is Ok. How can I fix this if I want that the legend to have a lesser size?</p>