Change data tip to your notation

15 ビュー (過去 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 Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by