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 Center および File ExchangeScatter Plots についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by