2011-04-15 10 views

Respuesta

5

Para hacer una leyenda de dos columnas, el consenso general parece ser que es necesario crear dos leyendas separadas y manualmente colocar al lado del otro. Solución simplificada de discussion here.

x = 1:10; 
y1 = rand(1, 10); 
y2 = rand(1, 10); 

h1 = plot(x, y1, '-'); 
hold on 
h2 = plot(x, y2, '-.r'); 

ah1 = gca; 
ah2 = axes('position',get(gca,'position'), 'visible','off'); 

legend(ah1, h1, 'Location', [0.5 0.85 0.15 0.05], 'y1') 
legend(ah2, h2, 'Location', [0.7 0.85 0.15 0.05], 'y2') 
+0

Estos trabajos ! El truco más importante en esta respuesta es ' 'Localización', [0,5 0,85 0,15 0,05]' cuando este último vector tiene un siguiente interpretación: '[Position_Right_in_pct, Position_Top_in_pct, Horizontal_Stretch Vertical_Stretch]' – Ufos

Cuestiones relacionadas