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 件のコメント
回答 (1 件)
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
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
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 Center および File Exchange で Bar Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!