How to place a global legend into an empty tile in a tiled layout?
    10 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Zhe Dong
 am 5 Jan. 2024
  
    
    
    
    
    Kommentiert: Dyuman Joshi
      
      
 am 5 Jan. 2024
            I'm making a 7x2 tiled layout figure, but I only have 13 subplots, which means I have an empty tile, I wonder if there's a way that I can place my global legend into the empty tile, to save some space and make the figure neater. I'm using the latest version of Matlab (2023b), any thoughts or suggestions are highly appreciated! 
0 Kommentare
Akzeptierte Antwort
  Dyuman Joshi
      
      
 am 5 Jan. 2024
        
      Bearbeitet: Dyuman Joshi
      
      
 am 5 Jan. 2024
  
      Yes, you can place the legend in the empty tile by specifying the tile number.
Here's a demo - 
%Plotting random data in the first 13 tiles
tiledlayout(7,2);
for k=1:13
    nexttile
    plot(sort(rand(10,1)), rand(10, 2))
end
%Define Legend
l = legend({'First line', 'Second line'});
%Changed the tile of the legend to the empty one which is 14 here
l.Layout.Tile = 14;
2 Kommentare
Weitere Antworten (0)
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!


