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
답변 (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!