scatter plot with color dependent on variable

조회 수: 4 (최근 30일)
Dilay Durmaz
Dilay Durmaz 2022년 6월 12일
댓글: dpb 2022년 6월 12일
I want to show all my data like this. In summary;
1. I want to show my data from each group in a different color
2. I want to create error bars like this.
3. I want to set the x and y axes from 1 to 5.
But I don't know how to do it. I'm just learning Matlab.
My codes is below;
scatter (UkWaterS,WaterBeS);
hold on
scatter (UkAG30S,AG30BeS);
hold on
scatter (UkAG40S,AG40BeS);
hold on
scatter (UkAG50S,AG50BeS);
hold on
scatter (UkAG60S,AG60BeS);
hold on
scatter (UkAG70S,AG70BeS);
% Add a colorbar
ColorVariable = 'UkWaterS','UkAG30S', 'UkAG40S','UkAG50S','UkAG60S','UkAG70S';
colorbar
w = c.LineWidth;
c.LineWidth = 1;
  댓글 수: 1
dpb
dpb 2022년 6월 12일
  1. Simply set the color for each in the initial call
2. That will take defining a line for each boundary and plotting those areas with patch
3. xlim([1 5]); ylim([1 5])
There are many examples in graphics in the doc section; explore those. Unfortunately, some graphics packages these days have left MATLAB HG2 far behind in the prepackaged appearance of some of these features like the shaded error bands. Not sure how the image you posted was created, but while it can be done in MATLAB, it's "roll your own" to do so; such a stylistic enhancement is not a prepackaged feature.

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

답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by