image thumbnail

Adjust legend marker size

version (1.2 KB) by Andreas
A function to adjust the marker size of the current legend without changing the plot marker size


Updated 10 Jan 2018

View License

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.
hold on
*** 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).

Cite As

Andreas (2021). Adjust legend marker size (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: setLegMarkSize(legendSizeDesired)

Community Treasure Hunt

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

Start Hunting!