Making a graph with multiple different colors
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Cris LaPierre
on 25 Apr 2023
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 Comments
Kevin Holly
on 25 Apr 2023
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
on 25 Apr 2023
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?
See Also
Categories
Find more on Bar Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!