필터 지우기
필터 지우기

Creating a scatter plot with three variables.

조회 수: 38 (최근 30일)
Brandon Bush
Brandon Bush 2018년 6월 5일
댓글: Star Strider 2020년 4월 15일
Hello, I am trying to create a scatter plot of some rain gauge data. I have three columns with data in them. My X variable is for Longitude, Y is Latitude and Z would be the rainfall totals. Each variable is a 31x1 double array. How can I get the Z variable to show up as individual points on the graph with color representing higher values?

채택된 답변

Star Strider
Star Strider 2018년 6월 5일
This uses the value of ‘Z’ to scale the colors:
x = 1:20;
y = 1:20;
[X,Y] = ndgrid(x,y); % Create Grids
Z = (X - 10).*(Y - 10); % Create ‘Z’
figure
scatter3(X(:), Y(:), Z(:), [], Z(:), 'filled') % Use ‘Z(:)’ To Scale Colors
Experiment to get the result you want with your data.
  댓글 수: 6
María Verónica Alba Valencia
María Verónica Alba Valencia 2020년 4월 15일
Thak you, too.
Star Strider
Star Strider 2020년 4월 15일
My pleasure!

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

추가 답변 (1개)

Honglei Chen
Honglei Chen 2018년 6월 5일
I would use scatterm, something like
scatterm(X,Y,5,Z)
The reference page can be found at
HTH
  댓글 수: 2
Brandon Bush
Brandon Bush 2018년 6월 5일
Thank you for your answer, when I use this I get an error message that says "error using gcm: Not a map axes"
Honglei Chen
Honglei Chen 2018년 6월 6일
I thought you want to plot lat and lon on a map.

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

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by