Visualization of the legend outside of the image

2 vues (au cours des 30 derniers jours)
Mateusz
Mateusz le 5 Oct 2013
Commenté : Mateusz le 10 Oct 2013
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.

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by