matlab marker太多,完美解决曲线Marker太多的问题

该函数`nummarkers`接收一组线型句柄`h`和一个整数`hnum`,将曲线上的标记点数量减少到指定数值。适用于数据点密集的曲线,防止因标记过多影响显示。示例中展示了如何使用该函数,并给出了警告处理和坐标轴范围的计算方法。
摘要由CSDN通过智能技术生成

function nummarkers(h,hnum)

% NUMMARKERS takes a vector of line handles in h

% and reduces the number of plot markers on the lines

% to num. This is useful for closely sampled data.

%

% example:

% t = 0:0.01:pi;

% p = plot(t,sin(t),'-*',t,cos(t),'r-o');

% nummarkers(p,10);

% legend('sin(t)','cos(t)')

%

% Created: Magnus Sundberg Feb 08, 2001

% Modified: [email]felonwan@gmail.com[/email] May 25, 2013

lh=length(h);

lhn=length(hnum);

if (lhn~=lh && lhn~=1)

error('The number of markers should be a scalar or a vector with equal length to the number of lines!')

end

for n = 1:lh

if lhn==1

num=hnum;

elseif lhn==lh

num=hnum(n);

end

if strcmp(get(

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值