Controlling markertype and linestyle in plotyy
9 次查看(过去 30 天)
显示 更早的评论
Hi all
I am using plotyy in the following way:
[AX,H1,H2] = plotyy(x1,y1,x2,[y2a y2b],'plot')
How do I assign different linestyle and markertype to the lines [y2a y2b]?
Cheers
Jakob
0 个评论
采纳的回答
the cyclist
2013-3-10
Here's one way:
x1 = 1:10;
y1 = 2:11;
x2 = 1:5;
y2a = 2:6;
y2b = 3:7;
figure
[ax h1 h2] = plotyy(x1,y1,x2,[y2a;y2b])
set(h1,'Marker','.','MarkerSize',8)
set(h2(1),'Marker','.','MarkerSize',24)
set(h2(2),'Marker','.','MarkerSize',48)
Note that I could instead have combined the setting of the Marker property for all objects like this:
set([h1;h2],'Marker','.')
更多回答(2 个)
Daniel Shub
2013-3-10
If you read the manual (doc plotyy) it tells you exactly how to do it in the example
set(H1,'LineStyle','--')
set(H2,'LineStyle,':')
1 个评论
the cyclist
2013-3-10
Notice that he wants to potentially set H2(1) and H2(2) to two different values, which is not so obvious.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!