Help making a 2D color plot

조회 수: 251(최근 30일)
birdnerd007 2020년 4월 25일
댓글: Star Strider 2020년 4월 25일
I have 3, 10 x 1 arrays. The first array is the x-position. The second array is the y-position. The third array is the indent depths as a function of the x and y positions. I want to create a 2D color plot with an X and Y axis and then the Z axis would be the different colors along the area of the x, y surface. Is there a way to do something like this? I want for different colors to represent different indent depths. I dont want this to be a 3D plot.
Thank you.

채택된 답변

Star Strider
Star Strider 2020년 4월 25일
Your problem statement appears to have eliminated most solutions.
Try this:
x = rand(10,1);
y = rand(10,1);
z = rand(10,1);
xv = linspace(min(x), max(x), numel(x));
yv = linspace(min(y), max(y), numel(y));
[X,Y] = ndgrid(xv, yv);
Z = griddata(x, y, z, X, Y);
surf(X, Y, Z)
% view(90,0)
It creates a 3D surface, then orients it with view to create a 2D plot.
  댓글 수: 4
Star Strider
Star Strider 2020년 4월 25일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by