Adjust legend marker size

Versión 1.5.0.0 (1,2 KB) por Andreas
A function to adjust the marker size of the current legend without changing the plot marker size
3,9K Descargas
Actualizado 10 ene 2018

Ver licencia

Usage:
legendmarkeradjust(markersize)
In some cases you might want a small sized marker on a scatter plot, but in order to see the different colors in the legend, the marker must be larger in size.
This function resizes the marker independently from the marker size of the scatter plot.
Example:
plot(1:100,'.');
hold on
plot([1:100].^1.5,'.r')
legend('First','Second')
legendmarkeradjust(20)
Enjoy
*** Warning concerning usage in versions later than 2014a:
This function works best for MATLAB 2014a and earlier.
For later versions, after using this function, no further changes of the legend are possible except its location. Make sure that this is the final modification you want to do to your legend.
In general I cannot guarantee that it will work as smoothly as in 2014a and earlier versions because the solution is somehow cumbersome (recreating the legend in order to have the possibility of independent adjustment of sizes).

Citar como

Andreas (2024). Adjust legend marker size (https://www.mathworks.com/matlabcentral/fileexchange/46105-adjust-legend-marker-size), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2016b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Legend en Help Center y MATLAB Answers.
Agradecimientos

Inspiración para: setLegMarkSize(legendSizeDesired)

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.5.0.0

Now it works for scatter as well

1.4.0.0

Fixed the condition for version control

1.3.0.0

This version can work both in older versions (2014a and before) as well as the latest one (2016b). The approach used to have the same effect in 2016b is ugly. I hope that MathWorks will allow independent adjustment in the future.
Added versions in-between 2014a and 2017a
Added readjusting the location as well
Edited description

1.2.0.0

added an example in the instructions

1.1.0.0

fixed for both scatter and plot generated plots

1.0.0.0