having legend title and enlarging legend marker size at the same time
조회 수: 6 (최근 30일)
이전 댓글 표시
Initially I had a legend as like this
As you can see, the size of the legend marker is much smaller than the size of the scatter marker. However, the legend has a title. I used below code for this:
lgd=legend('25','50','75','100','Location','northwest','FontSize',30);
lgd.Title.String = 'Recoating Velocity (%)';
lgd.Title.FontSize = 30;
Then, in order to increase the marker size in the legend, I used the icons as below:
[lgd,icons,plots,legend_text] = legend('25','50','75','100', 'Location', 'Northwest')
for k = 5:8
icons(k).Children.MarkerSize = 20;
end
lgd.Title.String = 'Recoating Velocity (%)';
lgd.Title.FontSize = 30;
And the result looks like this:
Although the marker size increased, but the legend title is not applied. Why is that? How to fix it?
댓글 수: 0
답변 (1개)
Gautam
2024년 10월 16일
편집: Gautam
2024년 10월 17일
Hello @CS
It is a known problem that a title to a legend cannot be added when calling the "legend" function with multiple outputs. In fact, calling the function this way is not recommended by MathWorks since the release R2014b and will be removed in a release after R2024b.
Please refer to the "Version History" section of the below MathWorks documentation.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!