Surface plot with custom data tip

조회 수: 3 (최근 30일)
Pedro Augusto de Castro e Castro
답변: darova 2020년 4월 23일
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