plot 2D matrix data

36 次查看(过去 30 天)
I have a numeric matrix array, with column 1 containing the x coordinate, column 2 containing the y coordinate, and column 3 containing the value at that xy position. How can I create a reliable 2d pcolor plot from this matrix?

采纳的回答

Star Strider
Star Strider 2021-8-4
The pcolor function requires a matrix argument, and the data provided here are a (5000 x 3) matrix with ‘X’, ‘Y’ and ‘Z’ columns. Creating a matrix from this is necessary if you want to use image, pcolor, or other such functions.
I would skip that and just use scatter3 and then rotate it using the view function:
LD = load('data.mat');
data25um = LD.data25um;
figure
scatter3(data25um(:,1), data25um(:,2), data25um(:,3), [], data25um(:,3), 's', 'filled')
grid on
xlabel('X')
ylabel('Y')
view(0,90)
axis('tight')
producing:
.
.

更多回答(1 个)

darova
darova 2021-8-2
Use griddata to create matrices
  1 个评论
Sam Hurrell
Sam Hurrell 2021-8-4
How can I use griddata for the data in its current form? The examples I've looked at seem to give values based on defined calculations rather from a data array?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by