How to plot legend above graph but not outside figure
    19 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I have a figure in a subplot and i want to put its legend above the graph but not outside the border. I have attatched an image of where i want the legend to be and preferably it should be oriented horizontally.
leg = legend('Healthy','Infected','Sick','Recovered');
0 Kommentare
Antworten (1)
  Cris LaPierre
    
      
 am 22 Mär. 2021
        leg = legend('Healthy','Infected','Sick','Recovered','Location','northeast');
2 Kommentare
  Cris LaPierre
    
      
 am 22 Mär. 2021
				
      Bearbeitet: Cris LaPierre
    
      
 am 22 Mär. 2021
  
			So to clarify, the legend in Capture.PNG is NOT what you want? You can still use the linked page to explore the available properties. For example, to have it not outside the border, you could do this.
plot(1:10,rand(10,4))
legend('Healthy','Infected','Sick','Recovered',...
    'Location','north',...
    'Orientation','horizontal')
To have it look more like Capture2.PNG, you could do this.
figure
plot(1:10,rand(10,4))
box off
legend('Healthy','Infected','Sick','Recovered',...
    'Location','northoutside',...
    'Orientation','horizontal')
legend('boxoff');
Siehe auch
Kategorien
				Mehr zu Legend finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



