Change data tip to your notation

조회 수: 7 (최근 30일)
Lev Mihailov
Lev Mihailov 2022년 7월 7일
답변: Simon Chan 2022년 7월 7일
I build a graph using surf, when using data tip it shows me X,Y,Z. And I want it to show "Age", "Male", "Pron. dialog".
s=surf(X,Y,Z,);
colormap(hot);
colorbar
set(gca,'clim',[1,40]);
xlabel('Age');ylabel('Male')
%
row = dataTipTextRow("Age",s.X);
s.DataTipTemplate.DataTipRows(end+1) = row;
Unrecognized method, property, or field 'T' for class 'matlab.graphics.chart.primitive.Surface'.
Error in MalahovaSondWav (line 21)
row = dataTipTextRow("Age",s.T);
Thanks in advance

답변 (1개)

Simon Chan
Simon Chan 2022년 7월 7일
If you would like to replace the name X,Y,Z to "Age", "Male", "Pron. dialog" respectively and display the same values, try the following:
s=surf(X,Y,Z);
colormap(hot);
colorbar
set(gca,'clim',[1,40]);
xlabel('Age');ylabel('Male')
s.DataTipTemplate.DataTipRows(1).Label = "Age";
s.DataTipTemplate.DataTipRows(2).Label = "Male";
s.DataTipTemplate.DataTipRows(3).Label = "Pron. dialog";

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by