Surface plot with custom data tip

5 次查看(过去 30 天)
Hello,
So, I have 4 data vectors X Y Z and F. A little example is something like this:
X = 2.3573 2.3366 2.3123 2.2936
Y = 1.2322 1.1182 1.2204 1.2158
Z = 0.9870 0.9849 0.9871 0.9870
F = 9600 10560 11520 12480
I want to plot this in a 3d surface plot, and later be able to create a custom data tip showing the information of the X, Y, Z and also the F.
I was able to do it with scatter3:
But I can't find a way to do a surface plot like this, and still be able to make a custom data tip.
Another question, can I use the same updatefcn for different figures, using a switch-case?

回答(1 个)

darova
darova 2020-4-23
Use griddata to interpolate your data
xx = linspace(min(X),max(X),20);
yy = linspace(min(Y),max(Y),20);
[X1,Y1] = meshgrid(xx,yy);
Z1 = griddata(X,Y,Z,X1,Y1);
F1 = griddata(X,Y,F,X1,Y1);
surf(X1,Y1,Z1,'cdata',F1)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by