Change Secod Axis Color And Tick Label Colors

116 次查看(过去 30 天)
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