hf = figure ("visible", "off");
unwind_protect
   axes ("units", "normalized");
   plot (1:10);
   hl = legend ("Legend Text", "units", "normalized");
   pos = get (gca, 'position');
   set (hf, 'position', [0, 0, 200, 200]);
   set (hl, 'fontsize', 20);
   assert (get (gca, 'position'), pos, 2*eps);
unwind_protect_cleanup
   close (hf);
end_unwind_protect
