24小时热门版块排行榜    

查看: 1930  |  回复: 1

Mr_reliable

新虫 (初入文坛)

[求助] 怎么设置legend使其一半虚线一半实线? 已有1人参与

回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Jeromelei

银虫 (初入文坛)

【答案】应助回帖

★ ★ ★
感谢参与,应助指数 +1
jjdg: 金币+3, 感谢参与 2017-08-23 12:00:47
Assume you use matlab

% Generate an example input data
dt = 0.0001;
t = -0.05 : dt : 0.05;
t0 = 0 : dt : 1/150;
f75Hz_p = [zeros(1, length(t(1) : dt : t0(1) - dt)), sin(2*pi*75*t0), zeros(1, length(t0(end) + dt : dt : t(end)))];
f75Hz_n = -[zeros(1, length(t(1) : dt : t0(1) - dt)), sin(2*pi*75*t0), zeros(1, length(t0(end) + dt : dt : t(end)))];

% Plot the data without any legend
figure(1);
plot(t, f75Hz_p, 'k-');
hold on;
plot(t, f75Hz_n, 'k:');

% By default, Matlab does not provide the legend property you want
% Therefore, you could use annotation textarrow property instead
% x and y are original positions for the textarrow, dx is used for
% incremental length of the textarrow
x = 0.15; y = 0.8; dx = 0.1;

% Drawing (headless) text arrows, so that one of them can have
% a string properly which is your legend entry label. Use x,y,dx
% for positioning
annotation('textarrow', [x,x+dx], [y,y], ...
    'linestyle', '-', 'color', 'k', 'textcolor', 'k', 'headstyle', 'none')
annotation('textarrow', [x+dx+0.005, x+2*dx+0.005], [y,y], ...
    'linestyle', ':', 'color', 'k', 'textcolor', 'k', 'headstyle', 'none')
annotation('textarrow', [x + 2*dx + 0.07, x + 3*dx], [y y], ...
    'linestyle', 'none', 'textcolor', 'k', 'headstyle', 'none', 'string', '75Hz')
2楼2017-08-23 03:38:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 Mr_reliable 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 大佬帮着分析今年的评审意见?该课题连续申请了三年了,明年要不要换个方向。 100+3 cai-11138 2026-08-31 10/500 2026-09-06 19:40 by babero
[考博] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 j5mmowWXNWxv 2026-09-05 4/200 2026-09-06 19:21 by eObJPa4gWmp6
[硕博家园] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +4 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 18:21 by eObJPa4gWmp6
[公派出国] 售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急 +3 jPDp0sc2B7zQ 2026-09-05 4/200 2026-09-06 18:09 by eObJPa4gWmp6
[博后之家] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 18:09 by eObJPa4gWmp6
[论文投稿] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +4 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 18:01 by eObJPa4gWmp6
[找工作] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +3 jPDp0sc2B7zQ 2026-09-05 8/400 2026-09-06 17:49 by eObJPa4gWmp6
[公派出国] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +3 jPDp0sc2B7zQ 2026-09-05 6/300 2026-09-06 17:21 by eObJPa4gWmp6
[考研] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 jPDp0sc2B7zQ 2026-09-04 8/400 2026-09-06 17:09 by eObJPa4gWmp6
[博后之家] 广西大学-广州大学招聘博士后 欢迎广大优秀人才!!! +5 SCSIOyxguo 2026-09-03 8/400 2026-09-06 15:06 by 可爱小花朵
[教师之家] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 j5mmowWXNWxv 2026-09-05 3/150 2026-09-06 13:09 by eObJPa4gWmp6
[硕博家园] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 jPDp0sc2B7zQ 2026-09-05 7/350 2026-09-06 11:20 by eObJPa4gWmp6
[基金申请] 科研人应该花精力去思考如何解决问题,而不是去凝练问题 +10 瞬息宇宙 2026-09-01 19/950 2026-09-06 11:15 by jiangxuan2004
[博后之家] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +3 jPDp0sc2B7zQ 2026-09-05 8/400 2026-09-06 11:09 by eObJPa4gWmp6
[论文投稿] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 jPDp0sc2B7zQ 2026-09-04 8/400 2026-09-06 11:00 by eObJPa4gWmp6
[考研] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +3 jPDp0sc2B7zQ 2026-09-05 4/200 2026-09-06 07:20 by E1iiBLMU2XnD
[教师之家] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +8 CRJ0Aq2FtVH0 2026-09-03 15/750 2026-09-06 05:48 by E1iiBLMU2XnD
[基金申请] 面上没中,邀请各位路过的虫友分析一下分数 +12 jackleilei 2026-09-03 13/650 2026-09-05 18:10 by fireguard
[硕博家园] Ei源刊怎么投 +4 Fengshun9711 2026-09-04 4/200 2026-09-04 19:30 by 研途知予
[基金申请] 要骂人了,新模版改版就是要淡化问题凝练这种虚的东西,结果有个评委还在说凝练得不够 +9 瞬息宇宙 2026-08-31 17/850 2026-09-02 14:04 by anjeeshine
信息提示
请填处理意见