Warning: Ignoring Legend entries...and I can't seem to figure it out!

2 views (last 30 days)
Hi All, I'm trying to generate a temperature-entropy plot (T-S) for one of my classes, and I am running into issues with the legend in my plot. It is showing all of the correct legend entries, however it is not showing the correct corresponding line color/type/point type. My code for one of the two plots is as follows.
if true
%
hp1 = plot(S,T, S,T_inside, '--b',S,T_inf_hp, '--y', S, T_ext_hp,'--g',S_1_hp, T_1_hp, '-ob',S_2_hp, T_2_hp, '-xr', S_3_hp, T_3_hp,'-*k');
%
legend(hp1 ,'Vapor Dome', 'Desired Indoor Temperature','Average Exterior Temperature','Extreme Exterior Temperature', 'Permutation 1', 'Permutation 2', 'Permutation 3')
%
title('T-s Diagram for R-134a Heat Pump')
xlabel('Specific Entropy (kJ/kg/K)')
ylabel('Temperature (C)')
end
(Note: The if true/end is something the editor put in when posting, I don't know if I'm putting my code in right...) The error code is: "Warning: Ignoring extra legend entries. > In legend at 291 In Project_3A at 80"
When I do the SAME thing for a second plot (pressure vs. enthalpy), and have less entries, it seems to work fine. When I split the plot up into seperate handles for each, and use a row vector of those handles with the legend command, it does not work. It's getting really frustrating, and I'm trying to avoid using paint to correct the line color and styles. any help is MUCH appreciated...thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!