MATLAB - adding additional data to surface plot tooltip
Ältere Kommentare anzeigen
I have created a cylinder with the help of a surface plot and a 360x512 matrix with some data(named map100).
When i put my cursor over the cylinder i see my X,Y,Z on the tooltip as expected. However i would also like to see the matrix(map100) value for that point on the tooltip as well. Is this possible ? and if so how?
Any help is much appreciated..
Antworten (1)
Walter Roberson
am 5 Nov. 2020
1 Stimme
See https://www.mathworks.com/help/matlab/creating_plots/create-custom-data-tips.html for R2019a and later.
I just confirmed that surf() do have the needed property.
9 Kommentare
Ali Shakeri
am 5 Nov. 2020
Walter Roberson
am 5 Nov. 2020
row = dataTipTextRow('m100', map100);
cyl.DataTipTemplate.DataTipRows(end+1) = row;
I think.
Ali Shakeri
am 5 Nov. 2020
Works for me when I try in R2020b.
z = randi(9, 30, 50);
map100 = sort(z) + randn(size(z));
cyl = surf(z);
row = dataTipTextRow('m100', map100);
cyl.DataTipTemplate.DataTipRows(end+1) = row;
Ali Shakeri
am 5 Nov. 2020
Ali Shakeri
am 5 Nov. 2020
Walter Roberson
am 6 Nov. 2020
I do not have your file or your input matrix to test with, and I posted demonstration code that showed that my approach works.
What is size(map100) ? It looks most likely to be 2D to me, but I cannot prove it from what has been posted.
You could try
row = dataTipTextRow('m100', 'map100');
cyl.DataTipTemplate.DataTipRows(end+1) = row;
Ali Shakeri
am 6 Nov. 2020
Walter Roberson
am 6 Nov. 2020
Did you try my sample code? Did it work for you?
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
