octave 之 legend用法

Function File:  legend  (str1str2, …) Function File:  legend  (matstr) Function File:  legend  (cellstr) Function File:  legend  (…, "location", pos) Function File:  legend  (…, "orientation", orient) Function File:  legend  (hax, …) Function File:  legend  (hobjs, …) Function File:  legend  (haxhobjs, …) Function File:  legend  ("option") Function File:  [hleghleg_objhplotlabels] =  legend  (…)

Display a legend for the current axes using the specified strings as labels.

Legend entries may be specified as individual character string arguments, a character array, or a cell array of character strings.

If the first argument hax is an axes handle, then plot into this axis, rather than the current axes returned by gca. If the handles, hobjs, are not specified then the legend’s strings will be associated with the axes’ descendants.legend works on line graphs, bar graphs, etc. A plot must exist before legend is called.

The optional parameter pos specifies the location of the legend as follows:

 poslocation of the legend
 northcenter top
 southcenter bottom
 eastright center
 westleft center
 northeastright top (default)
 northwestleft top
 southeastright bottom
 southwestleft bottom
 
 outsidecan be appended to any location string

The optional parameter orient determines if the key elements are placed vertically or horizontally. The allowed values are "vertical" (default) or "horizontal".

The following customizations are available using option:

"show"

Show legend on the plot

"hide"

Hide legend on the plot

"toggle"

Toggles between "hide" and "show"

"boxon"

Show a box around legend (default)

"boxoff"

Hide the box around legend

"right"

Place label text to the right of the keys (default)

"left"

Place label text to the left of the keys

"off"

Delete the legend object

The optional output values are

hleg

The graphics handle of the legend object.

hleg_obj

Graphics handles to the text and line objects which make up the legend.

hplot

Graphics handles to the plot objects which were used in making the legend.

labels

A cell array of strings of the labels in the legend.

The legend label text is either provided in the call to legend or is taken from the DisplayName property of graphics objects. If no labels or DisplayNames are available, then the label text is simply "data1""data2", …, "dataN".

Implementation Note: A legend is implemented as an additional axes object of the current figure with the "tag" set to "legend". Properties of the legend object may be manipulated directly by using set.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Octave中,eval函数的作用是将字符串作为命令执行。通过eval函数,可以动态地执行字符串中包含的Octave命令。例如,可以使用eval函数来给变量赋值,执行数学运算等操作。与MatLab相比,Octave的eval函数用法基本相同。 引用中给出了一个示例,使用eval函数将字符串中的命令执行。首先,将字符串str设置为['dsfd',num2str(4)],然后通过eval函数执行命令eval( [str, '= zeros(1,6)'])。这个命令的作用是将变量dsfd4赋值为一个6个元素全为0的向量。 在引用中提到,MatLab和Octave在运算符方面是兼容的。因此,在Octave中,可以使用x^2或者x**2来表示x的平方。 然而,引用指出MatLab和Octave在输出方面是不同的。在Octave中,输出结果可能会以不同的方式显示,并且与MatLab可能存在差异。因此,在使用eval函数时,特别是涉及到输出结果的情况下,需要注意这种差异。 总而言之,Octave的eval函数可以用于执行字符串中包含的Octave命令,并且与MatLab的eval函数用法基本相同。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Octave 数字转字符,连接两个字符串,以及如何将字符串转换为变量名称](https://blog.csdn.net/qq_32651245/article/details/110338367)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Octave:矩阵计算的新宠](https://blog.csdn.net/weixin_34194087/article/details/91586458)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值