Plotyy changes line style every time in for loop
1 次查看(过去 30 天)
显示 更早的评论
Hi All Please, I need help with inserting plotyy in for loop and every time the line styel and color will be changed. I have tried this
plotStyle = {'^b','ok:','or','og','om','oc','Xk','b+','r:','Xg','ok','or','g:'};
for j=1:n
figure(10+tt)
[AX,H1,H2]=plotyy(x{j},y{j},x{j},y_Cp{j},'plot');
set(get(AX(1), 'Ylabel'),'String',' Power (W)'); set(get(AX(2),'Ylabel'),'String','Power Coefficient (Cp)');
set(H1,'LineStyle',plotStyle{j}); set(H2,'LineStyle', plotStyle{j});
tt=tt+1;
Thanks in advance
end
0 个评论
采纳的回答
Walter Roberson
2013-9-6
[AX,H1,H2] = plotyy(x{j}, y{j}, x{j}, y_Cp{j}, @(X,Y) plot(X,Y,plotstyle{j}), @(X,Y) plot(X,Y,plotstyle{j}));
or
plotLineMarker = {'^', 'o', 'o', 'o', 'o', 'o', 'x', '+', 'none', 'x', 'o', 'o', 'none'};
plotLineStyle = {'none', ':', 'none', 'none', 'none', 'none', 'none', 'none', ':', 'none', 'none', 'none', ':'};
plotLineColor = {'b', 'k', 'r', 'g', 'm', 'c', 'k', 'b', 'r', 'g', 'k', 'r', 'g'};
[AX, H1, H2] = plotyy(x{j}, y{j}, x{j}, y_Cp{y},
set( [H1, H2], 'LineStyle', plotLineStyle{j}, 'Color', plotLineColor{j}, 'Marker', plotLineMarker{j});
更多回答(2 个)
A Jenkins
2013-9-5
There are separate 'LineStyle' and 'Marker' settings.
'LineStyle' just changes the Line Property. Valid choices are:
{-} -- : -. none
A similar set() command with 'Marker' would be used to change the marker property.
+ o * . x s d ^ v > < p h none
More adjustments (color, etc) can be found here:
0 个评论
另请参阅
类别
在 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!