【源码】hline与vline——绘制当前坐标轴上的水平线或垂直线

在这里插入图片描述

很常用的两个小函数,希望大家可以收藏。

hline和vline函数在当前坐标轴上的指定位置绘制水平线或垂直线。

These functions draw horizontal or verticallines at specified places on the current axes.

function hhh=vline(x,in1,in2)

% function h=vline(x, linetype, label)

% 在当前坐标轴上,以变量x指定的位置绘制垂直线。

% ‘linetype’(默认为’r’)和’label’为可选参数,应用于直线旁边的文本标签属性。

% 标签与直线的颜色相同。

% Draws a vertical line on the current axesat the location specified by ‘x’. Optional arguments % are ‘linetype’ (default is ‘r:’) and ‘label’, whichapplies a text label to the graph near the line.

% The label appears in the same color asthe line.

%

% 直线绘制结果在当前坐标轴下一直保持,在画线结束后,函数再返回以前的坐标轴状态。

% The line is held on the current axes, andafter plotting the line, the function returns the axes to

% its prior hold state.

% 直线的HandleVisibility属性设置为“off”,因此不仅不会显示在图例上,而且用findobj也是无法找到的。可以对直线指定一个返回的输出句柄,这样方便使用或删除。当ShowHiddenHandles属性设定为on时,HandleVisibility的设置将会被否决,即ShowHiddenHandles属性的优先级高于HandleVisibility。

% The HandleVisibility property of the lineobject is set to “off”, so not only does it not appear on

% legends, but it is not findable by usingfindobj. Specifying an output argumentcauses the

% function to return a handle to the line,so it can be manipulated or deleted. Also, the

% HandleVisibility can be overridden by settingthe root’s ShowHiddenHandles property to on.

% 函数使用举例

% h = vline(42,‘g’,‘The Answer’)

……

源码下载地址:

http://page2.dfpan.com/fs/8lc6j2621c29116f7d7/

更多精彩文章请关注微信号:在这里插入图片描述

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值