Plot with color variation from third variable

212 ビュー (過去 30 日間)
Ann
Ann 2021 年 1 月 8 日
コメント済み: Ann 2021 年 1 月 8 日
Hi, everyone.
My data have three variables which are Time (x-axis), S4 (y-axis) and PRN. I'm trying to plot the data color according to the PRN (refer code) and resulting as photo below. I want to know is it possible to make the data color in one by one color (e.g: Black, and another 30 colors according to total PRN) and not in gradient as below? Or do I need to manually coded each PRN for each color?
I appreciate any help you can provide.
clear
clc
%_______________Read data_______________%
Time=xlsread('Jan-para.xlsx','B:B');
S4=xlsread('Jan-para.xlsx','O:O');
PRN=xlsread('Jan-para.xlsx','C:C');
figure%>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FIGURE starts
scatter(Time,S4,10,PRN,'filled');
colorbar;
title('January 2014');
datetick('x', 'HH');
xlabel('Coordinated Universal Time, UTC (hr)');
ylabel('Amplitude scintillation, S4');
hold all
%_______________PRNall_______________%

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 1 月 8 日
Look at gscatter. It allows you to create a scatter plot using the value of a 3rd variable to set the color of you points.
  1 件のコメント
Ann
Ann 2021 年 1 月 8 日
Cool! It turns out nicely! Thank you kindly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by