MATLAB: Controlling markertype and linestyle in plotyy

linestylemarkertypeplotyy

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

Best Answer

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','.')