MATLAB Answers

0

Keeping plot titles in desired location

Asked by Hari krishnan on 15 May 2019
Latest activity Commented on by Hari krishnan on 16 May 2019
Hi, I am trying to keep the title of the plot towards the right side of the the figure rather than on the top. I wrote a code for doing this, but unfortunately i am not to get the desired result. Can it be done with a function other than 'title'? I tried with 'legend' and 'text', it didn't help me much. Any help to solve this will be appreciated.
image.png
for ii = 2:10:size(a,1)
str0 = sprintf('gdmatrix = %f', rowsum_for_ants_in_gdnest_matrix(ii));
str1 = sprintf('bnmatrix = %f', rowsum_for_ants_in_gdnest_matrix(ii));
str2 = sprintf('field = %f', rowsum_for_ants_in_gdnest_matrix(ii));
str3 = sprintf('home= %f', rowsum_for_ants_in_gdnest_matrix(ii));
title_obj = title({str3;str2;str1;str0});
end

  0 Comments

Sign in to comment.

1 Answer

Answer by Fangjun Jiang on 15 May 2019
 Accepted Answer

title_obj.Position;
title_obj.Position=[You Value Specified Here]

  3 Comments

@Fangju Jiang. Thank you for the suggestion. I tried this before and it was not working for me
What do you mean? By setting the position, the title can be set at any specified position, although the position value seems to be relative to the plotted data.
@ Fangu Jiang. Thank you. I normalised the asix, so i was not able to get desired output. Now its solved

Sign in to comment.