Change data tip to your notation

13 visualizzazioni (ultimi 30 giorni)
Lev Mihailov
Lev Mihailov il 7 Lug 2022
Risposto: Simon Chan il 7 Lug 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

Risposte (1)

Simon Chan
Simon Chan il 7 Lug 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";

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by