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).
引用格式
Andreas (2024). Adjust legend marker size (https://www.mathworks.com/matlabcentral/fileexchange/46105-adjust-legend-marker-size), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
致谢
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
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.
|
||
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 |