| 查看: 1862 | 回复: 1 | ||
[求助]
怎么设置legend使其一半虚线一半实线? 已有1人参与
|
|
如图片所示 发自小木虫Android客户端 |
» 猜你喜欢
参与限项
已经有3人回复
假如你的研究生提出不合理要求
已经有7人回复
实验室接单子
已经有4人回复
全日制(定向)博士
已经有4人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
不自信的我
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
北核录用
已经有3人回复
Jeromelei
银虫 (初入文坛)
- 应助: 1 (幼儿园)
- 金币: 817.9
- 帖子: 18
- 在线: 11.9小时
- 虫号: 4204365
- 注册: 2015-11-08
- 专业: 影像医学与生物医学工程
【答案】应助回帖
★ ★ ★
感谢参与,应助指数 +1
jjdg: 金币+3, 感谢参与 2017-08-23 12:00:47
感谢参与,应助指数 +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












回复此楼