Change Secod Axis Color And Tick Label Colors

조회 수: 229 (최근 30일)
Stephen Molnar
Stephen Molnar 2012년 5월 31일
I have a snippet of code that uses plotyy
figure;
x = 1:size(X1,1);
xlim([1,max(x)]);
y1 = env_data_values(1:m,12);
y2 = I_spec_max;
[haxes,hline1,hline2] = plotyy(x,y1,x,y2,'plot');
axes(haxes(1))
ylabel('Temperature ({^o}C)','Color','b')
axes(haxes(2))
ylabel('I_m_a_x','Color','r')
set(hline2,'Color','r')
set(hline1,'Color','b')
title('Dev OA TE Cooler vs. I_m_a_x');
hleg1=legend('I_m_a_x');
set(hleg1,'Location','NorthEast', 'Color', 'none', 'Box', 'off');
The right y-axis, tick marks and tick mark labels are green. I can't figure out how to change the color to red to match the color of the lie plot.
I've searched Answers, but haven't found anything that I can understand.
Thanks in advance.

답변 (1개)

Geoff
Geoff 2012년 6월 1일
set(haxes(2), 'YColor', 'r');

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by