フィルターのクリア

Scatterplot equivalent in plotting 3d data in 2d

2 ビュー (過去 30 日間)
Hasti Yavari
Hasti Yavari 2017 年 7 月 24 日
コメント済み: Walter Roberson 2017 年 7 月 25 日
Hi everyone,
I have three vectors of same size (54796X1 double) and want to plot them like the image attached. Using the scatter function, scatter(x,y ,35, z, 'filled'), naturally I get a plot made of dots. I increased the dot size to make the data look full but as you can see it is not a good solution. Do you know how the plot in the attached image is generated with the same data? I thought of image but I can not get it to work. I have attached the vectors in the workspace. Here is how I got my plot using scatter and contour:
scatter(x,y ,35, z, 'filled')
x_interpolated = linspace( -90, 90, 300 );
y_interpolated = linspace( -90, 90, 300 );
[ hx, hy ] = meshgrid( x_interpolated, y_interpolated );
F = TriScatteredInterp(x, y, z);
data_interpolated = F(hx, hy);
hold on
contour( x_interpolated, y_interpolated, data_interpolated, 10, 'k' );
Any help is highly appreciated.
/Hasti
  6 件のコメント
Walter Roberson
Walter Roberson 2017 年 7 月 24 日
It looks to me to be likely that your scatter plot is completely hidden by the contour plot. Both are in the z=0 plane and since they are the same depth and are both space filling areas instead of lines, the one that is going to show up is the one drawn last.
Hasti Yavari
Hasti Yavari 2017 年 7 月 24 日
Hi Walter, I understand your concern but that is not the case here. I can not upload anymore images due to mathworks regulations but if you just run the contour and scatter function lines separately you will see my point.

サインインしてコメントする。

採用された回答

KSSV
KSSV 2017 年 7 月 24 日
You need to do interpolation with the scattered data...and then use surf or pcolor. Read about scatteredInterpolant
  9 件のコメント
KSSV
KSSV 2017 年 7 月 24 日
Yes....you were taking a small region out of the given region.
Walter Roberson
Walter Roberson 2017 年 7 月 25 日
... and no scatter() plot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by