• 语法
      • legend(...,'Location','NorthOutside')
    • 帮助文档:http://www.mathworks.com/help/matlab/ref/legend.html
    • lcn — Legend location

      • 'north' | 'south' | 'east' | 'west' | 'northeast' | …
    • Legend location with respect to the axes, specified as one of the location values listed in this table. | Value | Description | | :—- | :—- | | 'north' | Inside top of axes | | 'south' | Inside bottom of axes | | 'east' | Inside right of axes | | 'west' | Inside left of axes | | 'northeast' | Inside top-right of axes (default for 2-D axes) | | 'northwest' | Inside top-left of axes | | 'southeast' | Inside bottom-right of axes | | 'southwest' | Inside bottom-left of axes | | 'northoutside' | Above the axes | | 'southoutside' | Below the axes | | 'eastoutside' | To the right of the axes | | 'westoutside' | To the left of the axes | | 'northeastoutside' | Outside top-right corner of the axes (default for 3-D axes) | | 'northwestoutside' | Outside top-left corner of the axes | | 'southeastoutside' | Outside bottom-right corner of the axes | | 'southwestoutside' | Outside bottom-left corner of the axes | | 'best' | Inside axes where least conflict occurs with the plot data at the time that you create the legend. If the plot data changes, you might need to reset the location to 'best'. | | 'bestoutside' | Outside top-right corner of the axes (when the legend has a vertical orientation) or below the axes (when the legend has a horizontal orientation) | | 'layout' | A tile in a tiled chart layout. To move the legend to a different tile, set the Layout property of the legend. | | 'none' | Determined by Position property. Use the Position property to display the legend in a custom location. |

    • Example: legend('Location','northeastoutside')

      参考链接:主题:如何在matlab中使得图例出来的位置不遮住曲线?