figure text cut off when saved

I am annotating a figure with text. The .fig looks fine, but when I save it as a jpeg or png, the sigmas are partially cut off (righthand edge of both, though my other annotations are OK.
htext=text(-2.5,40,sprintf('r=0.4214'));
htext2=text(-1.2,35,sprintf('-1\\sigma'));
htext3=text(0.75,40,sprintf('1\\sigma'));
htext4=text(-0.15,40,sprintf('\\mu'));
set(htext,'fontsize',20,'color',[0.42 0.42 0.42],'fontweight','bold');
set([htext2,htext3,htext4],'fontname','arial','fontsize',20,'color',[0.71 0.71 0.71],'fontweight','bold');
I have tried the following to fix the problem:
-Saved with command: print -dpng PDOcorr.png
-Saved from figure window using file-->saveas
-Used command set(gca, 'ActivePositionProperty', 'OuterPosition');
-Changed text location, size, and font
-used sprintf and also just used text('\sigma')
I cannot get my sigmas to appear in full in saved images! Please help! Also, I am working on a mac with R2012a. Have already dealt with a few matlab-mac bugs... wondering if figure text is another but cant find anything in bug reports.

답변 (3개)

Kim Shultz
Kim Shultz 2013년 4월 25일

1 개 추천

I have the same problem - it's not related to the length of the string (as far as I can tell) - the last part of a letter in all my axis labels and titles get cut off when saving. It's not a full solution, but if you add a couple spaces and then a period after the desired text, it generally fixes the issue. Doesn't seem to matter what file type you save as - I always use .png, but have tried .jpg too.
John Petersen
John Petersen 2012년 8월 8일

0 개 추천

Is it cutoff because the title is too long? If so, make your figure larger so that the title fits. Or change to a smaller font.

댓글 수: 2

Nina
Nina 2012년 8월 9일
Thanks for the response, John. Unfortunately, its not the title, it is text within the figure placed using text(x,y,'string'). I can't figure out how to upload the figure here, but have it at: http://www.wrcc.dri.edu/research/noakley/PDO.html Quite the mystery with these sigmas!
John Petersen
John Petersen 2012년 11월 2일
Try saving as a .emf file or other format. jpg is not a good format for graphs with lines and text.

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

Garrett Gross
Garrett Gross 2013년 12월 31일

0 개 추천

Same issue here, running R2012a. My title, legend and x-axis labeling are all cut by one character. I added a few spaces after the title and axis label but the legend was still cut. I put a period after the data label which worked but it didn't cut the period? weird.
i.e. title('Resultant Force ')

댓글 수: 1

Image Analyst
Image Analyst 2013년 12월 31일
Like I told someone earlier today, try using a smaller font or adjusting the 'InnerPosition' property.

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

카테고리

도움말 센터File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

질문:

2012년 8월 7일

댓글:

2013년 12월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by