Helping adding Tittle to Plot (multititle)
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I have a contour plot and i need a title like that for it:
"my title" variable1 variable2
My title is a character string always the same, but variable1 and variable2 change with every plot.
I have tried this:
title('my title', variable1, variable2);
But it did not work.
Error in ==> title at 55
set(h, 'String', string, pvpairs{:});
I also want to add units to the colourbar and a legend
Thank you very much!
댓글 수: 0
채택된 답변
Star Strider
2015년 1월 5일
If ‘variable1’ and ‘variable2’ are strings, this works:
variable1 = 'Velocity';
variable2 = 'Position';
figure(1)
scatter(rand(10,1), rand(10,1), 'bp')
title(sprintf('“My Title“ %s %s', variable1, variable2))
댓글 수: 10
UCRMechanicalEngineer
2016년 6월 29일
편집: UCRMechanicalEngineer
2016년 6월 29일
Thank you, this helped me.
추가 답변 (1개)
Julian Hapke
2015년 1월 5일
title(['my title' var1 var2])
depending on the variable type, you may have to convert to string and add separators like whitespace when concatenating.
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!