3D plot of Latitude, Longitude and Depth while the colour of the points represent earthquake magnitude

13 ビュー (過去 30 日間)
I have been able to plot the points using scatter3 but I am struggling on making the colour of the points represent the earthquake magnitude. I am using an excel file with the following columns 'lat', 'long', 'depth' and 'mag'. I have 2461 earthquakes to plot therefore it is a 2461x4 table. Below is the code I have used to plot the points and I have attached a screenshot of what I get when I run the code. I have also attached a screenshot called "Desired_Result" which is what I would like the final product to look like. I do not have much MATLAB experience so any help you can provide would be greatly appreciated! Thank you!
eqs = readtable('India.xlsx');
%Defining Variables
lat = table2array(eqs(:,1));
long = table2array(eqs(:,2));
Depth = table2array(eqs(:,3));
Mag = table2array(eqs(:,4));
%plot
scatter3(long,lat,Depth)
%reversing the z axis
set(gca,'ZDir','reverse')
%Labels
ylabel('Latitude')
xlabel('Longitude')
zlabel('Depth(km)')
Title('Himalaya Earthquakes')

採用された回答

KSSV
KSSV 2022 年 8 月 2 日
scatter3(long,lat,Depth,[],Depth,'filled')
  1 件のコメント
Michelle Pearce
Michelle Pearce 2022 年 8 月 2 日
Thank you! That worked! I just put scatter3(long,lat,Depth,[],Mag,'filled') instead. Thank you again!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEarthquake Engineering についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by