Multi column legend in matlab plot

How can i set multicolumn and row legen in matlab R2016a,.
I could not find simple way to do it.

1 comentario

If you use MATLAB R2018a or later, you can use the NumColumns property of legend to specify the number of columns.
plot(rand(12))
legend('NumColumns',3,'Location','southOutside')

Iniciar sesión para comentar.

 Respuesta aceptada

dpb
dpb el 14 de Jun. de 2023

0 votos

7 comentarios

Sudhir Rai
Sudhir Rai el 15 de Jun. de 2023
hi,
It is not working in R2016a. It gives error:
"Undefined function or variable 'gridLegend'."
Dyuman Joshi
Dyuman Joshi el 15 de Jun. de 2023
Did you download and open the file contents in the current directory?
Sudhir Rai
Sudhir Rai el 15 de Jun. de 2023
Yes
Dyuman Joshi
Dyuman Joshi el 15 de Jun. de 2023
It is compatible with R2016a.
Can you please attach your code, so we can reproduce the error? Use the paperclip button to attach your code or you can just copy and paste it as well.
Sudhir Rai
Sudhir Rai el 15 de Jun. de 2023
Ok. I made mistake by not copying gridlegend file to same directory.
It worked . Thanks for pointing it out. Thanks for the help.
dpb
dpb el 15 de Jun. de 2023
Things like this I put into a special directory created and added to the MATLABPATH so will always be available regardless of the current working directory for project files. I find that structure works best.
Sudhir Rai
Sudhir Rai el 22 de Jun. de 2023
ok thanks................
But how can I change legend features like make it bold or change size in gridlegend?

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 14 de Jun. de 2023

Comentada:

el 22 de Jun. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by