Making a 2d scatter plot with multiple data sets and color map

조회 수: 137 (최근 30일)
Joseph Tirado
Joseph Tirado 2021년 8월 2일
댓글: Star Strider 2021년 8월 2일
I am trying to plot three different data sets with data x, y and z against each other where z would depict the color. Right now I can only make a scatter plot that graphs x and y of the three data sets on the sane plot by doing this:
scatter(RAAVtime,RAAValt,RAAVtemp,'filled');
hold on;
scatter(newTime1,FAlt_ave1,Temp_ave1,'filled','s')
hold on;
scatter(newTime,FAlt_ave,Temp_ave,'filled','d');
I want the z collumn or temp data to depict the color of the scatter data by creating a colormap however nothing I've been trying using the colormap function has been working. Any advice?

답변 (1개)

Star Strider
Star Strider 2021년 8월 2일
Use the third argument of scatter to determine the size of the points, and the fourth argument of scatter to determine the colours:
x = randn(1,10);
y = randn(1,10);
z = randn(1,10);
figure
scatter(x, y, [], z, 'filled','s')
grid
See the documentation section on Vary Circle Color for details.
.
  댓글 수: 2
Joseph Tirado
Joseph Tirado 2021년 8월 2일
I should have been more specific, I am not trying to make a scatter plot with colors I choose but with a heat map based on the z data
Star Strider
Star Strider 2021년 8월 2일
That definitely would have been appropriate, since the scatter function was posted!
If you have R2017a or later, the heatmap function may do what you want.
.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by