How do I plot three variables against each other?

조회 수: 5 (최근 30일)
Sophia Salazar
Sophia Salazar 2019년 6월 28일
댓글: Star Strider 2019년 6월 28일
I have a list of lightning flahses, each flash has a latitude, longitude, and a power. All three of these are lists, not matrices.
I would like to plot a 3D plot, where x is longitude, y is latitude, and each dot is color coded to represent its power at the latitude and longitudinal locations.
How do I do this using three lists? The 3d plotting functions, like imagesc, require a matrix as the third value.
Thanks!

채택된 답변

Star Strider
Star Strider 2019년 6월 28일
Try this:
lat = rand(10,1); % Create Vector
lon = rand(10,1); % Create Vector
power = randi(9,10,1); % Create Vector
figure
scatter3(lat(:), lon(:), power(:), [], power(:), 'filled')
grid on
This will colour them by the ’Z’ (’power’) value. The fourth argument [] is the size reference, and since you may want them all the same size, that argument is the empty array.
  댓글 수: 6
Sophia Salazar
Sophia Salazar 2019년 6월 28일
Name Size Bytes Class Attributes
Latitude 393413x1 3147304 double
Longitude 393413x1 3147304 double
PeakCurrentQuarter 393413x1 3147304 double
Star Strider
Star Strider 2019년 6월 28일
I have no idea what the problem could be.
I would need at least a representative sample of your data to see what the problem is (assuming I could reproduce it).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by