Visualization of the legend outside of the image

조회 수: 2 (최근 30일)
Mateusz
Mateusz 2013년 10월 5일
댓글: Mateusz 2013년 10월 10일
Hi,
I am using the following code to visualize the image with legend:
currImg = imread(imagePath);
fig = figure('Visible', 'off');
imshow(currImg);
hold all;
legendHandler = legend(textLegend(:), 'Location', 'BestOutside');
set(legendHandler,'FontSize',8);
hold off;
print(fig, '-djpeg', outfilepath);
Unfortunately, in some cases I get a legend that doesn't fit in the figure (see the attached image). How can I fix it?
[update] It seems the real culprit is
print(fig, '-djpeg', outfilepath);
as imshow shows the image correctly.

채택된 답변

Image Analyst
Image Analyst 2013년 10월 6일
Have you tried other location options, such as 'Best'?
  댓글 수: 4
Mateusz
Mateusz 2013년 10월 10일
I use ghexport and it seems it works now.
hgexport(fig, outfilepath, hgexport('factorystyle'), 'Format', 'jpeg');
Mateusz
Mateusz 2013년 10월 10일
Ok, it seems export_fig works better, thanks a lot!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by