Line color in plotyy graph
18 次查看(过去 30 天)
显示 更早的评论
Hi all,
I use this code to plot a yy graph.
ratio=((Power./1000)-1240)./(Power./1000);
plotyy(P.e_hp./100,Power./1000,P.e_hp./100,ratio,'plot','plot');
Power and P.e_hp are 1*53 vectors. I want to give color to the plotted lines but at the same time set the color of all axes black. Any ideas how to do it? I am looking it up without much help. Thanks in advance!
0 个评论
回答(1 个)
Walter Roberson
2015-5-25
[hAx,hLine1,hLine2] = plotyy(P.e_hp./100,Power./1000,P.e_hp./100,ratio);
set(hLine1, 'Color', 'r');
set(hLine2, 'Color', 'b');
set(hAx, 'Color', 'k');
2 个评论
Walter Roberson
2015-5-25
Note: the Color property of axes is the backplane color. If you want to set the color of the box, set XColor and YColor. If you want to set the color of the tick labels, then leave the TickLabelInterpreter property set to its default 'tex' and modify the XTickLabel and YTickLabel properties so that each string is of the form '\color{NAME}TICKTEXT' or '\color[rgb]{R,G,B}TICKTEXT' such as '\color{magenta}1.5x10^{4}'
另请参阅
类别
在 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!