Adjust legend marker size

버전 1.5.0.0 (1.2 KB) 작성자: Andreas
A function to adjust the marker size of the current legend without changing the plot marker size
다운로드 수: 3.8K
업데이트 날짜: 2018/1/10

라이선스 보기

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 릴리스 호환 정보
개발 환경: R2016b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Legend에 대해 자세히 알아보기

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.
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