Stretching Legend Box between two axes
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
in the appendix I have a figure with two subplots. It would be nice if the legend box would reach from the left Y-axis to the right Y-Axis. Has anyone got an idea? The code I used to format the legend so far is the following one:
leg1 = legend('\boldmath{$\dot{Q}_{sh,t}$}','\boldmath{$\dot{P}_{t}$}','\boldmath{$\dot{Q}_{S,t}$}','\boldmath{$\dot{Q}_{L,t}$}','\boldmath{$\dot{Q}_{IST\rightarrow DSHP,t}$}','\boldmath{$\dot{Q}_{TS\rightarrow DSHP,t}$}'...
,'\boldmath{$\dot{Q}_{TS\rightarrow IST,t}$}','\boldmath{$T_{TES,t,1}$}','\boldmath{$T_{HC,t}$}','\boldmath{$T_{IST,t}$}','\boldmath{$T_{TS,out,t}$}');
set(leg1,'Interpreter','latex');
set(leg1,'FontSize',10);
legend('Location','northoutside','Orientation','horizontal');
Regards,
SR89
0 comentarios
Respuestas (1)
Prakhar Jain
el 16 de Nov. de 2018
Hi Sasan,
Custom location and size, specified as a four-element vector of the form [left bottom width height]. The first two values, left and bottom, specify the distance from the lower left corner of the figure to the lower left corner of the legend. The last two values, width andheight, specify the legend dimensions. The Units property determines the position units.
If you specify the Position property, then MATLAB® automatically changes the Location property to 'none'.
example: legend({'A','B'},'Position',[0.2 0.6 0.1 0.2]);
You can change the width to more to make it appear to full length as shown in figure attached by you.
Hope this helps.
Thanks.
0 comentarios
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!