Change data tip to your notation

15 views (last 30 days)
Lev Mihailov
Lev Mihailov on 7 Jul 2022
Answered: Simon Chan on 7 Jul 2022
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

Answers (1)

Simon Chan
Simon Chan on 7 Jul 2022
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";

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!