Line color in plotyy graph

50 views (last 30 days)
Fotis
Fotis on 25 May 2015
Commented: Fotis on 25 May 2015
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!

Answers (1)

Walter Roberson
Walter Roberson on 25 May 2015
[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 Comments
Walter Roberson
Walter Roberson on 25 May 2015
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}'
Fotis
Fotis on 25 May 2015
Thanks!

Sign in to comment.

Categories

Find more on Two y-axis in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!