How I can change the legend of a graph from vertical to horizontal
285 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dawj Alami
el 8 de Ag. de 2017
Comentada: Steven Lord
el 21 de Jun. de 2023
hay, I want to present a graph with a horizontal legend. And my program in Matlab it gives a graphical presentation with Legend vertical is what I can change it and how.. ?? I would like to have a horizontal legend below the X axis
program:
figure(9);
plot(x,TFVP1S,'-k','linewidth',1.5)
hold on
plot(x,TSVP1S,'--k','linewidth',1.5)
plot(x,TFMSLTS,'-r','linewidth',1.5)
plot(x,TSMSLTS,'--r','linewidth',1.5)
plot(x,TFAS,'-m','linewidth',1.5)
plot(x,TSAS,'--m','linewidth',1.5) ....
xlabel('Dimensionless length X = x/H','FontSize',12)
ylabel('Dimensionless temperature','FontSize',12)
legend('Thetaf VP1 (t* = 2)','Thetas VP1 (t* = 2)','Thetaf MSLT (t* = 2)','Thetas MSLT (t* = 2)','Thetaf Air (t* = 2)','Thetas Air (t* = 2)','Thetaf VP1 (t* = 4)','Thetas VP1 (t* = 4)','Thetaf MSLT (t* = 4)','Thetas MSLT (t* = 4)','Thetaf Air (t* = 4)','Thetas Air (t* = 4)',1)
Help me..
0 comentarios
Respuesta aceptada
José-Luis
el 8 de Ag. de 2017
plot(rand(10,3));
legend({'a','b','c'},'Orientation','horizontal');
8 comentarios
Steven Lord
el 21 de Jun. de 2023
As of release R2018a you can set the NumColumns property of a legend to control in how many columns the legend entries are arranged. This should help with the "long legend" problem described in this first comment on this answer.
Más respuestas (0)
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!