Change Secod Axis Color And Tick Label Colors

228 vues (au cours des 30 derniers jours)
Stephen Molnar
Stephen Molnar le 31 Mai 2012
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.

Réponses (1)

Geoff
Geoff le 1 Juin 2012
set(haxes(2), 'YColor', 'r');

Catégories

En savoir plus sur Two y-axis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by