- 语法
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 theLayout
property of the legend. | |'none'
| Determined byPosition
property. Use thePosition
property to display the legend in a custom location. |Example:
legend('Location','northeastoutside')