Making a graph with multiple different colors

1 次查看(过去 30 天)
I am trying to make a graph where the x values is "number" and the y values are " Amplitude, PSD, Recurrance_Rate, Recurrance_Points, Determinism, Ratio_Determinism_Recurrance_Rate, Average_Diagonal_Length, Average_Vertical_Length, Laminarity, Divergence, Entropy, Trapping_Time, OSA_Label" with different colors for each one. This is the code i have so far.
data = xlsread('project.xlsx')
Number = data(:, 1)
Amplitude = data(:, 2)
PSD = data(:, 3)
Recurrance_Rate = data(:, 4)
Recurrance_Points = data(:, 5)
Determinism = data(:, 6)
Ratio_Determinism_Recurrance_Rate= data(:, 7)
Average_Diagonal_Length = data(:, 8)
Average_Vertical_Length = data(:, 9)
Laminarity = data(:, 10)
Divergence = data(:, 11)
Entropy = data(:, 12)
Trapping_Time= data(:, 13)
OSA_Label = data(:, 14)
The data waas originally in an excel spreadsheet and i assigned each column its own name. Please help
  2 个评论
Alexander
Alexander 2023-4-25
i basically have an excel spreadsheet with 14 columbs and 1085 rows and need to find a way to compare it all. Any suggestions?

请先登录,再进行评论。

回答(1 个)

Cris LaPierre
Cris LaPierre 2023-4-25
Just use plot with a legend
data = readmatrix('project.xlsx')
varNames = ["Number","Amplitude","PSD","Recurrance_Rate","Recurrance_Points","Determinism","Ratio_Determinism_Recurrance_Rate","Average_Diagonal_Length","Average_Vertical_Length","Laminarity","Divergence","Entropy","Trapping_Time","OSA_Label"];
plot(data)
colororder(parula(length(varNames)));
legend(varNames)
  3 个评论
Kevin Holly
Kevin Holly 2023-4-25
You can convert the matrix into a table, which will make it compatible as an input to many functions that can do what you mentioned.
data = readmatrix('project.xlsx')
Tbl = array2table(data);
varNames = ["Number","Amplitude","PSD","Recurrance_Rate","Recurrance_Points","Determinism","Ratio_Determinism_Recurrance_Rate","Average_Diagonal_Length","Average_Vertical_Length","Laminarity","Divergence","Entropy","Trapping_Time","OSA_Label"];
Tbl.Properties.VariableNames = {varNames}
Are you doing a classification or regression problem and need to perform machine learning? If so, you could use the Classification Learner app or the Regression Learner App depending on what you would want to do. See video below:
Cris LaPierre
Cris LaPierre 2023-4-25
Or just use readtable.
Your question seems to be wandering from the original one on creating a graph with multiple lines. What is the new question?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Bar Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by