MATLAB: How to make the legend fully shows in the plot

legendMATLABposition;

There is a problem when drawing the legend. As shown in the picture, the legend is set on top of the figure, but some contents miss. So how can the legend fully be shown in the figure?
untitled.jpg

Best Answer

Reduce the vertical position of the legend.
legend(. . .,'location',[0.32,0.97,0.37,0.05]);
% [1] [2] [3] [4]
The values above describe
  1. the horizontal placement of the left edge
  2. the vertical placement of the bottom edge
  3. the width
  4. the height
of the legend in normalized units (0:1). Instead of 0.97, try 0.95.